mirror of
https://codeberg.org/postscriptum/snac2nex.git
synced 2026-04-01 21:55:27 +00:00
add comments, dump attachment copy event
This commit is contained in:
parent
9c835a9ec0
commit
ae0661ad78
1 changed files with 8 additions and 2 deletions
10
src/nex.rs
10
src/nex.rs
|
|
@ -84,6 +84,8 @@ impl Nex {
|
||||||
match source {
|
match source {
|
||||||
Source::Url(url) => url,
|
Source::Url(url) => url,
|
||||||
Source::File(from) => {
|
Source::File(from) => {
|
||||||
|
// attachments directory starts with dot in this implementation
|
||||||
|
// it is usually hidden but accessible in the servers like Nexy
|
||||||
let d = format!(".{}", published.format(&self.filename));
|
let d = format!(".{}", published.format(&self.filename));
|
||||||
let mut to = PathBuf::from(&p);
|
let mut to = PathBuf::from(&p);
|
||||||
to.push(&d);
|
to.push(&d);
|
||||||
|
|
@ -92,12 +94,16 @@ impl Nex {
|
||||||
.file_name()
|
.file_name()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.replace("post-", "");
|
.replace("post-", ""); // cleanup extras from readable txt
|
||||||
to.push(&f);
|
to.push(&f);
|
||||||
if !to.exists() {
|
if !to.exists() {
|
||||||
fs::copy(&from, &to).unwrap();
|
fs::copy(&from, &to).unwrap();
|
||||||
|
println!(
|
||||||
|
"\t\t\tcopy attachment file `{}`",
|
||||||
|
to.to_string_lossy()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
format!("{d}/{f}")
|
format!("{d}/{f}") // relative URI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue