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

Forbidden when Move or Rename Files or Folders #6824

Closed
georgeoftown opened this issue Oct 18, 2018 · 7 comments
Closed

Forbidden when Move or Rename Files or Folders #6824

georgeoftown opened this issue Oct 18, 2018 · 7 comments
Assignees
Labels
bug p2-high Escalation, on top of current planning, release blocker ReadyToTest QA, please validate the fix/enhancement
Milestone

Comments

@georgeoftown
Copy link

Expected behaviour

Move or rename file or folder

Actual behaviour

403 Forbidden MOVE

Steps to reproduce

  1. Configure Client with Server Address ended with slash (Example https://owncloud.org/)
  2. Sync something
  3. Move or rename folder or file synced
  4. Sync Error

Server configuration

Operating system:
Debian 9.5
Web server:
Apache/2.4.25
Database:
mysql Ver 15.1 Distrib 10.1.26-MariaDB
PHP version:
PHP 7.0.30-0+deb9u1
ownCloud version:
10.0.10

Client configuration

Client version:
2.5.0 (build 10560)
Operating system:
Windows 10
OS language:
ES

Logs

  1. Client logfile: Output of owncloud --logwindow or owncloud --logfile log.txt
#=#=#=# Syncrun started 2018-10-18T11:56:20Z
#=#=#=#=# Propagation starts 2018-10-18T11:56:20Z (last step: 196 msec, total: 196 msec)
11:56:21||Pruebas/Prueba2 -> Pruebas/1|INST_RENAME|Up|1539862451|5bc86fa3018b9|0|00057074511b5315c9cf7|2|El servidor respondió "403 Forbidden" a "MOVE https://owncloud.org/remote.php/dav/files/aaaaaa.mmmmm/Pruebas/Prueba3"|403|0|0|fb133929-61e9-4e83-b085-4cb86af6c2a1|
11:56:21||Pruebas/2 -> Pruebas/23|INST_RENAME|Up|1539862435|5bc86fa7e0977|0|00057075511b5315c9cf7|2|El servidor respondió "403 Forbidden" a "MOVE https://owncloud.org/remote.php/dav/files/aaaaaa.mmmmm/Pruebas/2"|403|0|0|6790c65c-179f-44b8-b92c-347c81aff3c8|
#=#=#=# Syncrun finished 2018-10-18T11:56:20Z (last step: 171 msec, total: 368 msec)
  1. Web server error log:
    look the 3 slash together ///
111.111.111.111 - - [18/Oct/2018:10:26:05 +0000] "MOVE /remote.php/dav/files/aaaaaa.mmmmm/Prueba/Prueba3 HTTP/1.1" 403 297 ///remote.php/dav/files/aaaaaa.mmmmm/Prueba/Prueba2
  1. Expected
111.111.111.111 - - [18/Oct/2018:10:27:23 +0000] "MOVE /remote.php/dav/files/aaaaaa.mmmmm/Prueba/Prueba3 HTTP/1.1" 201 - //remote.php/dav/files/aaaaaa.mmmmm/Prueba/Prueba4
  1. Server logfile: ownCloud log (data/owncloud.log):
    https://gist.github.com/georgeoftown/614821c3bef3ddc074893c5f65d0fd63#file-owncloud-log

Possible solutions

  1. Remove multiple slash at the beginning of _destination leaving only one
    req.setRawHeader("Destination", QUrl::toPercentEncoding(_destination, "/"));
  2. Remove slash at the end of the url line on client file config owncloud.cfg
2\url=https://owncloud.org <-- works
2\url=https://owncloud.org/ <-- forbidden
@guruz
Copy link
Contributor

guruz commented Oct 19, 2018

@georgeoftown As no one else is reporting this, I think this could be a problem of how you configured ownCloud/PHP in your Apache config? Can you paste this here?

@pumasloth
Copy link

@georgeoftown
I have been having the same issues lately (seem to have started after 2.5 desktop client release, mostly with renaming/moves that have already been uploaded to the server.

I tried removing the slash in the owncloud.cfg (%AppData%\ownCloud), restarted the desktop client and uploaded some folders/files then renamed/moved them and haven't gotten an error yet.
2\url=https://owncloud.org <-- works
2\url=https://owncloud.org/ <-- forbidden

@ogoffart
Copy link
Contributor

The problem is most likely the extra slash here:

QString destination = QDir::cleanPath(propagator()->account()->url().path() + QLatin1Char('/')
+ propagator()->account()->davPath() + propagator()->_remoteFolder + _item->_renameTarget);

since the dav path already starts with a /.
Actually, Account::davPath only starts with a / when chunking-ng is enabled, so we can't just remove the /.
I'd hope QDir::cleanPath remove the useless slashes, but it seems it does not.

@guruz guruz added this to the 2.5.1 milestone Oct 23, 2018
@guruz guruz added bug p2-high Escalation, on top of current planning, release blocker and removed Needs info Server Involved labels Oct 23, 2018
@guruz
Copy link
Contributor

guruz commented Oct 23, 2018

@ogoffart @pumasloth @georgeoftown ˜Thanks. we should fix this for 2.5.1

@ogoffart
Copy link
Contributor

It turns out that QDir::cleanPath on windows leaves the starting slashes on windows, as it can mean something.

ogoffart added a commit that referenced this issue Oct 24, 2018
QDir::cleanPath does not remove starting slashes on windows.
So use account::davUrl which is already cleaned

Issue: #6824
ogoffart added a commit that referenced this issue Oct 24, 2018
QDir::cleanPath does not remove starting slashes on windows.
So use account::davUrl which is already cleaned

Issue: #6824
@ogoffart ogoffart added ReadyToTest QA, please validate the fix/enhancement and removed PR available labels Oct 24, 2018
@georgeoftown
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug p2-high Escalation, on top of current planning, release blocker ReadyToTest QA, please validate the fix/enhancement
Projects
None yet
Development

No branches or pull requests

5 participants