add comments, dump attachment copy event

This commit is contained in:
postscriptum 2025-07-01 22:37:05 +03:00
parent 9c835a9ec0
commit ae0661ad78

View file

@ -84,6 +84,8 @@ impl Nex {
match source {
Source::Url(url) => url,
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 mut to = PathBuf::from(&p);
to.push(&d);
@ -92,12 +94,16 @@ impl Nex {
.file_name()
.unwrap()
.to_string_lossy()
.replace("post-", "");
.replace("post-", ""); // cleanup extras from readable txt
to.push(&f);
if !to.exists() {
fs::copy(&from, &to).unwrap();
println!(
"\t\t\tcopy attachment file `{}`",
to.to_string_lossy()
)
}
format!("{d}/{f}")
format!("{d}/{f}") // relative URI
}
}
));