- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.6k
fix(files): Properly encode URLs when preparing ZIP download #51684
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
Conversation
| /backport to stable31 | 
| /backport to stable30 | 
| /backport to stable29 | 
| /compile | 
Signed-off-by: Fabian Zwemke <fabian@zwemke.de>
Signed-off-by: Fabian Zwemke <fabian@zwemke.de>
| url = new URL(nodes[0].encodedSource) | ||
| let base = url.pathname | ||
| for (const node of nodes.slice(1)) { | ||
| base = longestCommonPath(base, (new URL(node.source).pathname)) | ||
| base = longestCommonPath(base, (new URL(node.encodedSource).pathname)) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this path as the URL constructor should already encode the URL so this smells like double encoding. Will test tomorrow with some more examples.
| The backport to  # Switch to the target branch and update it
git checkout stable29
git pull origin stable29
# Create the new backport branch
git checkout -b backport/51684/stable29
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 9fd0d263 52cabd78
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/51684/stable29Error: Failed to check for changes with origin/stable29: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. | 
| The backport to  # Switch to the target branch and update it
git checkout stable30
git pull origin stable30
# Create the new backport branch
git checkout -b backport/51684/stable30
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 9fd0d263 52cabd78
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/51684/stable30Error: Failed to check for changes with origin/stable30: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. | 
| Not backportable for 29 & 30 because #48098 created too much differences :) | 
| Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) | 
Summary
Fixed two issues in downloadAction.ts that prevented users from downloading multiple files when one of the file names included a comma or a hash symbol.
downloadAction.ts:66: Changed decodeURI to decodeURIComponent
decodeURI does not decode characters that are not part of the URI syntax. For example, a file named "A,B.txt" was requested as "A%2CB.txt".
downloadAction.ts:58,61: Changed "new URL(nodes[0].source)" to "new URL(nodes[0].encodedSource)"
In .source, hash symbols are not escaped, which confuses the logic as url.pathname does not include the hash symbol and everything after it.
Checklist
Sorry for the second PR, I forgot the signoff message in the first..