Skip to content
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

dav: fix wrong decoding of pluses in URLs #40594

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

lorenz
Copy link
Contributor

@lorenz lorenz commented Sep 22, 2023

Summary

PHP's urldecode function does not decode URLs according to RFC 3986, but according to the HTML 4.01 query parameter
encoding. This results in pluses being wrongly decoded to spaces even though they should not be decoded at all.

Use rawurldecode instead, which follows RFC 3986 properly.

This fixes an issue where files on DAV shares containing pluses were incorrectly decoded to spaces.

Fixes #15849
Fixes #40943

Checklist

@szaimen szaimen added the 3. to review Waiting for reviews label Sep 23, 2023
@szaimen szaimen added this to the Nextcloud 28 milestone Sep 23, 2023
@szaimen szaimen requested review from icewind1991, a team, ArtificialOwl and Fenn-CS and removed request for a team September 23, 2023 07:20
@lorenz
Copy link
Contributor Author

lorenz commented Oct 19, 2023

Pinging @icewind1991 @ArtificialOwl @Fenn-CS, this has been sitting for nearly a month and is a one-liner.

@skjnldsv skjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
This was referenced Nov 14, 2023
@blizzz blizzz modified the milestones: Nextcloud 28, Nextcloud 29 Nov 23, 2023
@m-baertschi
Copy link

I had this problem that the Dav Backend lost / did not sync Files with a plus sign. I have tested this PR and it fixes it. @icewind1991 @ArtificialOwl @Fenn-CS please merge this.

Copy link
Contributor

@Fenn-CS Fenn-CS left a comment

Choose a reason for hiding this comment

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

+1

@skjnldsv skjnldsv added feature: dav technical debt 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jan 30, 2024
@skjnldsv
Copy link
Member

/backport to stable28

PHP's urldecode function does not decode URLs according to RFC 3986, but
according to the HTML 4.01 query parameter
encoding. This results in pluses being wrongly decoded to spaces even
though they should not be decoded at all.

Use rawurldecode instead, which follows RFC 3986 properly.

This fixes an issue where files on DAV shares containing pluses were
incorrectly decoded to spaces.

Fixes: nextcloud#15849
Signed-off-by: Lorenz Brun <[email protected]>
@skjnldsv skjnldsv merged commit ebd46c2 into nextcloud:master Jan 31, 2024
124 of 133 checks passed
Copy link

welcome bot commented Jan 31, 2024

Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22

This comment was marked as resolved.

@lorenz lorenz deleted the fix-dav-url branch February 2, 2024 02:58
@blizzz blizzz mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish backport-request bug feature: dav technical debt
Projects
None yet
6 participants