Repository navigation
BitstreamUrlSerializer: keep the full query string and fragment - #1595
Merged
Merged
Conversation
Split the URL at the first raw '?' or '#' instead of destructuring url.split('?'),
which dropped everything after a second raw '?' in the query and encoded a
'#fragment' into the filename.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 tasks
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
These assertions hardcode the segment index (4), which makes the tests brittle if the route depth… · New These assertions hardcode the segment index (4), which makes the tests brittle if the route depth… · New This changes behavior for URLs that end with a bare separator, e.g./bitstream/.../file.pdf?or… · New This changes behavior for URLs that end with a bare separator, e.g./bitstream/.../file.pdf?or… · New
What changed in this PR
This PR fixes BitstreamUrlSerializer so it preserves the full query string (including additional raw ? characters inside values) and correctly handles URL fragments without encoding them into the filename.
Changes:
- Split bitstream URLs at the first raw
?or#and only encode the pathname portion. - Reattach query string + fragment unchanged after encoding the filename.
- Add specs covering “raw
?inside query values” and “fragment not encoded into filename”.
| File | Description |
|---|---|
| src/app/core/url-serializer/bitstream-url-serializer.ts | Updates URL splitting/reattachment logic to preserve query+fragment while encoding only the filename segment. |
| src/app/core/url-serializer/bitstream-url-serializer.spec.ts | Adds regression tests for raw ? in query values and fragment handling. |
Review effort: Lite
Copilot stopped reviewing on behalf of
milanmajchrak due to an error
October 17, 2026 17:16
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
After #873,
BitstreamUrlSerializerseparates the path from the query withconst [path, query] = url.split('?'). This has two problems:?in the query is dropped. For example, with?isAllowed=y?x&sequenceId=2, everything after the second?is lost, includingsequenceId, which the legacy guard reads.#fragmentwithout a query is encoded into the filename. For example,file.pdf#page=2becomes the filenamefile.pdf%23page%3D2, so the lookup fails.This affects client-side parsing in particular: SSR never receives fragments.
Fix
The URL is now split at the first raw
?or#(url.search(/[?#]/)). Only the path part is encoded, as before. The remainder (query and fragment) is re-attached unchanged. The diff is 4 lines.The same serializer file is in the companion
customer/zcu-pubPR, which backports #873 (zcu-pub never received it) plus this change. Branches that already have #873 (customer/lindat,vsb-tuo,mendelu-v7,palo-docker*) would get this change when synced from dtq-dev.Search for existing fixes
UrlSerializer, so there is nothing to backport.Tests
Two specs in
bitstream-url-serializer.spec.ts. Before the fix: 2 failed / 5 passed. After: 7/7 pass. Lint is clean.?: guards that the whole query reaches the router.#...is not encoded into the filename.Lab
dtq-dev was not run in the lab. The identical serializer was lab-tested on ZCU (
customer/zcu-pub, 7.6): 240 bitstreams x 5 legacy URL variants, with and without the DSpace 6 query.?isAllowed=y?x&sequence=1returns 302.Codex gate
PASS (round 2, run jointly with the zcu-pub PR). Codex also noted a pre-existing dtq-dev issue that this PR does not change:
legacyBitstreamURLRedirectGuardpasses the decoded filename unencoded, andbase-data.servicedoes not escape query values. As a result, filenames with&,+,?or#may not resolve on dtq-dev/lindat. This is unverified in the lab and is a candidate follow-up.🤖 Generated with Claude Code