Skip to content

Fix attachment cookie handling with Firefox First-Party Isolation - #635

Closed
pellaeon wants to merge 1 commit into
zotero:masterfrom
pellaeon:master
Closed

Fix attachment cookie handling with Firefox First-Party Isolation#635
pellaeon wants to merge 1 commit into
zotero:masterfrom
pellaeon:master

Conversation

@pellaeon

Copy link
Copy Markdown

This PR:

  1. Resolve cookies using the originating tab’s Firefox FPI and container context, and avoid combining cookies from unrelated partitions.

  2. Gracefully continue attachment downloads when cookie enumeration fails, scope temporary Cookie headers to the exact request URL, and preserve browser cookie semantics when injecting contextual cookies.

  3. Also retain compatibility with older Chromium versions that reject partitionKey and preserve the tab context during bot-bypass retries.

Fixes #226

The code changes are proposed by a LLM and manually reviewed by me line-by-line. Manual testing shows that this PR fixes PDF saving issues on Firefox with FPI enabled.

Resolve cookies using the originating tab’s Firefox FPI and container
context, and avoid combining cookies from unrelated partitions.

Gracefully continue attachment downloads when cookie enumeration fails,
scope temporary Cookie headers to the exact request URL, and preserve
browser cookie semantics when injecting contextual cookies.

Also retain compatibility with older Chromium versions that reject
partitionKey and preserve the tab context during bot-bypass retries.
@adomasven

Copy link
Copy Markdown
Member

Could you provide URLs, procedures and software versions with which you manually tested this and confirmed it works?

@pellaeon

Copy link
Copy Markdown
Author

Before fix behavior:

  1. navigate firefox to PDF URL
  2. open Zotero app (flatpak 9.0.4)
  3. click the Zotero connector icon to save
  4. the icon turns into a red X mark, says "save failed" , PDF did not show up in Zotero app

After fix behavior:
4. the icon turns into a green check mark, PDF shows up in Zotero app.

@adomasven adomasven closed this in 1a15ade Aug 19, 2026
@adomasven

Copy link
Copy Markdown
Member

Thanks for the PR. This wasn't quite in the state that we'd be able to merge, but I used it as a starting point for a smaller change. It's now available in the Zotero Connector Beta

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Can't get cookies in Firefox first-party-isolation mode

2 participants