Propfind with a query returns a invalid download url in public link
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 8.8k
- Forks
- 2.1k
- Avg merge
- 20h 7m
- Merged PRs (30d)
- 41
Description
Steps to reproduce
- create a public link of a folder with a file in it
- send propfind request to the public link endpoint with a random get
❯ curl -XPROPFIND http://localhost/core/remote.php/dav/public-files/sF3TYbCisUlOXpY\?query\=value --data-raw '<?xml version="1.0"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"> \
<d:prop> \
<oc:downloadURL /> \
</d:prop> \
</d:propfind>' | xmllint --format -
Expected behaviour
get the download URL without the query parameter
Actual behaviour
the download URL contains query in the middle and makes the URL invalid
<oc:downloadURL>http://localhost/core/remote.php/dav/public-files/sF3TYbCisUlOXpY?query=value/testavatar.jpg</oc:downloadURL>
full response
❯ curl -XPROPFIND http://localhost/core/remote.php/dav/public-files/sF3TYbCisUlOXpY\?query\=value --data-raw '<?xml version="1.0"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"> \
<d:prop> \
<oc:downloadURL /> \
</d:prop> \
</d:propfind>' | xmllint --format -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 790 100 639 100 151 18257 4314 --:--:-- --:--:-- --:--:-- 22571
<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
<d:response>
<d:href>/core/remote.php/dav/public-files/sF3TYbCisUlOXpY/</d:href>
<d:propstat>
<d:prop>
<oc:downloadURL/>
</d:prop>
<d:status>HTTP/1.1 404 Not Found</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/core/remote.php/dav/public-files/sF3TYbCisUlOXpY/testavatar.jpg</d:href>
<d:propstat>
<d:prop>
<oc:downloadURL>http://localhost/core/remote.php/dav/public-files/sF3TYbCisUlOXpY?query=value/testavatar.jpg</oc:downloadURL>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
</d:multistatus>
Server configuration
Operating system: ubuntu 20.04
Web server: apache2
Database: mysql
PHP version: 7.4
ownCloud version: (see ownCloud admin page) git latest
Updated from an older ownCloud or fresh install:
Where did you install ownCloud from: git
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the PROPFIND request against the public link endpoint using the curl command and inspect the handling of the oc:downloadURL property. Done means the returned download URL keeps the query parameter out of the path and remains valid for the file, as shown by the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100