mirror of
https://codeberg.org/postscriptum/snac2nex.git
synced 2026-03-31 13:15: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 {
|
||||
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
|
||||
}
|
||||
}
|
||||
));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue