copying a folder within a public link folder to folder with same name as an already existing file overwrites the parent file
Open
Nobody has claimed this yet.
Type:Bug
- Dominant language
- PHP
- Stars
- 8.8k
- Forks
- 2.1k
- Avg merge
- 20h 7m
- Merged PRs (30d)
- 41
Description
Description
When we copy a folder (e.g testFolder) within a public link folder to a folder which has same name as an already existing file (e.g copy1.txt), then the new copied folder overwrites the previously existing file of same name.
Steps to reproduce
- Create a user
Alice - User
Alicecreates a folderPARENT1 - User
Alicecreates another folderPARENT1/testFolder - User
Aliceuploads a file with contentsome datatoPARENT1/testFolder/testfile.txt - User
Aliceuploads a file with contentsome data 1toPARENT1/copy1.txt - User
Alicecreates a public link share with pathPARENT1and permissionsread,update,create,delete
[User gets a token in the response eg:zSr0bOKQfLbbv7C] - The public copies folder
testFoldertocopy1.txtusing new public webdav api:
curl -X COPY -H "Destination: http://localhost/core/remote.php/dav/public-files/zSr0bOKQfLbbv7C/copy1.txt" 'http://localhost/core/remote.php/dav/public-files/zSr0bOKQfLbbv7C/testFolder' -k -v
Expected behaviour
A 403 Forbidden error
Actual behaviour
HTTP/1.1 204 No Content
Date: Mon, 13 Jul 2020 07:59:13 GMT
Server: Apache/2.4.29 (Ubuntu)
Set-Cookie: oc7d03sfymph=t3ks17eksv5lbd0k3h6jd3rvhm; path=/core; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: oc_sessionPassphrase=%2Fjnmv9tt3noSLDBwDIXNH9co4VI%2BCcDP2GYor7ez%2FhD96neYW6RAlCPYGm9aCP57k4EfH3D7Sy%2Fc78qPKftCTw%2BA6U9ecjqtoATNbih3ME3oCnrFdSIv9xqPgwE2G444; path=/core; HttpOnly; SameSite=strict
Content-Security-Policy: default-src 'none';
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Robots-Tag: none
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
Checking Content
To make sure if the file has been overwritten:
curl -X GET http://localhost/core/remote.php/webdav/PARENT1/copy1.txt/testfile.txt -u alice:1234 -k
some data%
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
Start at the public WebDAV API endpoint used by the COPY request and reproduce the folder-to-existing-file case from the listed curl command. Trace how the destination is resolved and run the relevant WebDAV tests, adding coverage for the expected 403 Forbidden response without losing the existing file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100