Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Download (no annotations)" doesn't download snapshot attachment #591

Open
AbeJellinek opened this issue Jan 15, 2025 · 3 comments
Open

Comments

@AbeJellinek
Copy link
Member

Just opens it in a new tab, since it isn't served with Content-Disposition: attachment.

@AbeJellinek AbeJellinek changed the title "Download (no annotations)" doesn't download snapshot "Download (no annotations)" doesn't download snapshot attachment Jan 15, 2025
@tnajdek tnajdek added this to the 1.6 milestone Jan 24, 2025
@tnajdek
Copy link
Member

tnajdek commented Jan 29, 2025

I don't think this can be fixed in the web library and would indeed require a header.

@dstillman would it be feasible to add Content-Disposition header to files served from files.zotero.net?

@tnajdek tnajdek removed this from the 1.6 milestone Jan 29, 2025
@dstillman
Copy link
Member

It's not specific to snapshots. "Download (no annotations)" doesn't download for PDFs either.

How are we triggering downloading for regular "Download" for PDFs?

@tnajdek
Copy link
Member

tnajdek commented Jan 30, 2025

How are we triggering downloading for regular "Download" for PDFs?

We fetch the file, use PDF Worker to convert Zotero annotations into PDF annotations, and serve the produced blob using an a element with the download attribute, which is clicked via JS (at least in most cases - we rely on an npm module that handles various quirks in different browsers). However, this approach has limitations, such as the maximum blob size and a delay (when you click a "Download" button, a spinner appears).

Unfortunately, the download attribute only works for same-origin URLs (as well as blob: and data: URLs). Since the file is hosted at files.zotero.org, the download attribute will be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants