Skip to content

ZCU-DATA/fix: escape double quotes in Content-Disposition header for allzip download#1267

Merged
milanmajchrak merged 3 commits intocustomer/zcu-datafrom
zcu-data-fix-allzip-content-disposition
Mar 13, 2026
Merged

ZCU-DATA/fix: escape double quotes in Content-Disposition header for allzip download#1267
milanmajchrak merged 3 commits intocustomer/zcu-datafrom
zcu-data-fix-allzip-content-disposition

Conversation

@milanmajchrak
Copy link
Collaborator

@milanmajchrak milanmajchrak commented Mar 12, 2026

Problem description

The allzip endpoint was generating an invalid Content-Disposition header when the item name contained double quotes (e.g. manuscript titles with quoted terms). This caused ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION in browsers.

Added buildContentDisposition() method using RFC 5987 encoding:

  • filename param: ASCII fallback with escaped quotes and backslashes
  • filename*: UTF-8 percent-encoded for modern clients

Added integration tests for:

  • Item names with embedded double quotes
  • Item names with non-ASCII characters (diacritics)

Manual Testing (if applicable)

Copilot review

  • Requested review from Copilot

…dpoint

The allzip endpoint was generating an invalid Content-Disposition header when
the item name contained double quotes (e.g. manuscript titles with quoted
terms). This caused ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION in
browsers.

Added buildContentDisposition() method using RFC 5987 encoding:
- filename param: ASCII fallback with escaped quotes and backslashes
- filename*: UTF-8 percent-encoded for modern clients

Added integration tests for:
- Item names with embedded double quotes
- Item names with non-ASCII characters (diacritics)
Copilot AI review requested due to automatic review settings March 12, 2026 15:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes invalid Content-Disposition generation for the allzip download when item names contain special characters (notably double quotes and non-ASCII), by generating an RFC 5987-compatible header and adding integration coverage for these cases.

Changes:

  • Add buildContentDisposition() to generate filename (ASCII fallback with escaping) + filename* (UTF-8 percent-encoded).
  • Update the allzip download endpoint to use the new Content-Disposition builder.
  • Add integration tests covering item names with embedded double quotes and diacritics.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
dspace-server-webapp/src/main/java/org/dspace/app/rest/MetadataBitstreamController.java Uses a new helper to build a safe RFC 5987 Content-Disposition header for allzip downloads.
dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamControllerIT.java Adds integration tests asserting correct Content-Disposition formatting for quoted and non-ASCII item names.

You can also share your feedback on Copilot code review. Take the survey.

…dpoint

The allzip endpoint was generating an invalid Content-Disposition header when
the item name contained double quotes (e.g. manuscript titles with quoted
terms). This caused ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION in
browsers.

Added buildContentDisposition() method using RFC 5987 encoding:
- filename param: ASCII fallback with escaped quotes and backslashes
- filename*: UTF-8 percent-encoded for modern clients

Added integration tests for:
- Item names with embedded double quotes
- Item names with non-ASCII characters (diacritics)
@milanmajchrak milanmajchrak requested a review from vidiecan March 12, 2026 15:38
@milanmajchrak milanmajchrak merged commit 7b9966f into customer/zcu-data Mar 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants