fix: Prevent empty token in download links for authenticated owners#2523
Merged
monkeyiq merged 1 commit intofilesender:development3from Jan 28, 2026
Merged
Conversation
… only when it is not empty.
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.
Description
This PR fixes the
TokenHasBadFormatExceptionwhen a transfer owner tries to download files as an archive from the Transfer Detail page.Closes #2516
The Problem
When the owner views their transfer details and clicks "Download as ZIP", the generated download link includes
token=(empty string). The backend interprets this as "there is a token" and tries to validate it, which fails because an empty string is not a valid UID.Root cause: In
templates/transfer_detail_page.php, the download link is always built with'token' => $token, even when$tokenis empty.The Solution
Instead of modifying the backend (as suggested in the issue), this PR fixes the root cause in the frontend:
Before:
After:
This allows the backend to correctly fall through to the
elseif(Auth::isAuthenticated())block, which properly validates the owner's session.Why Frontend Fix Instead of Backend?
The issue suggested changing
download.phpto use!empty()instead ofarray_key_exists(). While that would also work, fixing the frontend is cleaner because:Files Modified
templates/transfer_detail_page.php- Only include token in download links when it has a valid valueType of change