Skip to content

Fix Referer handling and improve media naming in downloads - #134

Merged
m4siha merged 2 commits into
mainfrom
bugfix/capture-referer-and-title
Sep 6, 2026
Merged

Fix Referer handling and improve media naming in downloads#134
m4siha merged 2 commits into
mainfrom
bugfix/capture-referer-and-title

Conversation

@ja7ad

@ja7ad ja7ad commented Sep 6, 2026

Copy link
Copy Markdown
Owner

A CDN with hotlink protection refuses an object to a client that does not say which page linked it. The extension has always captured the referer and sent it over the extbus; the app logged it and dropped it, so every request went out without one and the download failed where the browser succeeded — reported against a 4K MP4 that plays fine in the tab.

The referer now travels with the item, like StreamInfo::referer already
does for a manifest's segments: ExtDownload -> DownloadItem::referer ->
StartSpec -> request_headers, which the transfer and every probe share. probe_link takes those headers too, so the File Info dialog asks the same question the transfer will and reports a real size instead of ?.

Verified against the reporter's own signed URL: without the referer the probe gets nothing, with it 109566922 bytes.

Naming: download-stream already titled a captured stream after the page, download-url sent no name at all, so a direct file landed under whatever the CDN stored it as — a uuid, renamed by hand afterwards. A sniffed media file whose basename is opaque now takes the page title, as IDM does; a file that names itself, and any link the sniffer never saw, keep their own name.

Also surfaces the background-download switch in Options > Downloads. It was reachable only from inside the File Info dialog, which is why the same report asked for a confirm-before-downloading button that already existed.

Fixes #133

…e page

A CDN with hotlink protection refuses an object to a client that does not
say which page linked it. The extension has always captured the referer and
sent it over the extbus; the app logged it and dropped it, so every request
went out without one and the download failed where the browser succeeded —
reported against a 4K MP4 that plays fine in the tab.

The referer now travels with the item, like `StreamInfo::referer` already
does for a manifest's segments: `ExtDownload` -> `DownloadItem::referer` ->
`StartSpec` -> `request_headers`, which the transfer and every probe share.
`probe_link` takes those headers too, so the File Info dialog asks the same
question the transfer will and reports a real size instead of `?`.

Verified against the reporter's own signed URL: without the referer the
probe gets nothing, with it 109566922 bytes.

Naming: `download-stream` already titled a captured stream after the page,
`download-url` sent no name at all, so a direct file landed under whatever
the CDN stored it as — a uuid, renamed by hand afterwards. A sniffed media
file whose basename is opaque now takes the page title, as IDM does; a file
that names itself, and any link the sniffer never saw, keep their own name.

Also surfaces the background-download switch in Options > Downloads. It was
reachable only from inside the File Info dialog, which is why the same
report asked for a confirm-before-downloading button that already existed.
@ja7ad
ja7ad requested a review from m4siha September 6, 2026 15:10
@ja7ad ja7ad added the bug Something isn't working label Sep 6, 2026
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.97%. Comparing base (1375044) to head (a08a667).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #134      +/-   ##
==========================================
- Coverage   73.98%   73.97%   -0.01%     
==========================================
  Files          69       69              
  Lines       29154    29154              
==========================================
- Hits        21569    21567       -2     
- Misses       7585     7587       +2     

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@m4siha
m4siha merged commit 6fbbeda into main Sep 6, 2026
16 checks passed
@m4siha
m4siha deleted the bugfix/capture-referer-and-title branch September 6, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: browser-captured downloads drop the Referer (403 on hotlink-protected sites) and are named after the CDN's id

2 participants