mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-21 18:55:36 +02:00
feat(core): auto-title for HTTP/S URL downloads
http::download now returns (hash, extension, Option<title_hint>). Title is derived from Content-Disposition filename header (RFC 5987 filename*= preferred over plain filename=), falling back to the last path segment of the final URL after redirects (percent-decoded). capture.rs Source::Url arm passes the title through to record_media_entry instead of None, so entries like 'Facharbeit.pdf' or 'facharbeit' appear in the Title column instead of the raw entry_uid. Adds percent_decode(), title_from_content_disposition(), title_from_url() helpers with 10 new unit tests (122 total, all green).
This commit is contained in:
parent
03abfb4d18
commit
143f71bc17
2 changed files with 166 additions and 7 deletions
|
|
@ -707,7 +707,7 @@ pub fn perform_capture(archive_paths: &ArchivePaths, locator: &str) -> Result<Ca
|
|||
// Source: generic HTTP/S file URL
|
||||
if source == Source::Url {
|
||||
match downloader::http::download(locator, store_path, ×tamp) {
|
||||
Ok((hash, file_extension)) => {
|
||||
Ok((hash, file_extension, title_hint)) => {
|
||||
let temp_file = store_path
|
||||
.join("temp")
|
||||
.join(×tamp)
|
||||
|
|
@ -743,7 +743,7 @@ pub fn perform_capture(archive_paths: &ArchivePaths, locator: &str) -> Result<Ca
|
|||
&hash,
|
||||
&file_extension,
|
||||
byte_size,
|
||||
None,
|
||||
title_hint,
|
||||
)?;
|
||||
database::finish_archive_run(&conn, run.id)?;
|
||||
return Ok(CaptureResult {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue