Skip to content

Renaming to .htaccess problems in UI #28441

Closed

Description

@phil-davis

Steps to reproduce

  1. Create a file aaaa.txt
  2. Try to rename to .htaccess

Expected behaviour

A reasonable error message is displayed - e.g. Could not rename "aaaa.txt"
The original aaaa.txt file is listed in the UI.

Actual behaviour

Error displayed:

Could not rename "aaaa.txt", it does not exist any more

and the file is gone from the display in the UI.

Note: refreshing the page brings back the file aaaa.txt to the UI list. So the original file is still there on server storage.

Server configuration

Operating system:
Ubuntu 16.04
Web server:
PHP dev
Database:
MySQL
PHP version:
7.0
ownCloud version: (see ownCloud admin page)
10.0.2+ current master as of right now 20/07/2017

Client configuration

Browser:
Firefox 54.0
Operating system:
Ubuntu 16.04

Activity

  1. changed the title [-]Renaming to forbidden file name returns [/-] [+]Renaming to .htaccess problems in UI[/+] on Jul 20, 2017
  2. phil-davis commented on Jul 20, 2017

    @phil-davis
    ContributorAuthor

    This causes test failures in the Travis-CI Saucelabs UI tests, where they try to do a rename to .htaccess.
    So all Travis-CI runs against current master are failing.
    Started when #25494 was merged.
    The CI for that PR passed, because it happened 10 months ago:
    https://travis-ci.org/owncloud/core/builds/165233987
    At that time, these UI tests did not exist. Now that there are UI tests, they have the chance to fail (like this)

  3. phil-davis commented on Jul 20, 2017

    @phil-davis
    ContributorAuthor

    If you try to rename a file to some string that is not a valid file name, then it returns 409:

    NetworkError: 409 Conflict - http://localhost:8080/remote.php/dav/files/admin/aaaa.txt
    

    If you try to rename to .htaccess then it returns 404:

    NetworkError: 404 Not Found - http://localhost:8080/remote.php/dav/files/admin/aaaa.txt
    

    and that causes the JS in the UI to think that that aaaa.txt has gone away, so it displays that error message and removes it from the list of displayed files.

    I guess it should return the same 409 so that the UI code will react in the same way.

  4. phil-davis commented on Jul 20, 2017

    @phil-davis
    ContributorAuthor

    Options for resolving this quickly so that Travis-CI in master will pass:

    1. Somebody fix the bug that has been exposed (if easy/quick to fix)
    2. Revert the commit from Switch the web UI to the new endpoint for logged in users #25494
    3. Skip the failing tests and tag them with this issue, so they can be enabled again when the issue is fixed: Skip tests that fail due to issue 28441 #28442

    Choose one.

  5. individual-it commented on Jul 20, 2017

    @individual-it
    Member

    renaming a file to something containing a back slash \ does return

    HTTP/1.1 400 Bad Request
    <?xml version="1.0" encoding="utf-8"?>
    <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:o="http://owncloud.org/ns">
      <s:exception>OCA\DAV\Connector\Sabre\Exception\InvalidPath</s:exception>
      <s:message>File name contains at least one invalid character</s:message>
      <o:retry xmlns:o="o:">false</o:retry>
      <o:reason xmlns:o="o:">File name contains at least one invalid character</o:reason>
    </d:error>
    

    what I guess is the correct error result.
    using a / in the file name when renaming it, tries to move the file into an other folder. It works if the folder exists. If the folder does not exist a 409 error is returned. Even ../ works if the file is located in a sub-folder

  6. individual-it commented on Jul 20, 2017

    @individual-it
    Member

    when fixing this need to remember to take off @skip @issue-28441 tags in:

  7. PVince81 commented on Jul 20, 2017

    @PVince81
    Contributor

    let's skip the issue then.

    So apparently thanks to your tests this API inconsistency could be discovered. Cool

  8. self-assigned this
    on Jul 20, 2017
  9. added this to the development milestone on Jul 20, 2017
  10. added
    p2-high
    on Jul 20, 2017
  11. phil-davis commented on Jul 20, 2017

    @phil-davis
    ContributorAuthor

    We got lucky. I expect that there are plenty of other (hopefully little) things, specially where the JS in the UI might do UI stuff differently if the new dav endpoint responds a bit differently (different status code, message...) than the old end point did.
    In theory, the integration tests should find all issues with the API itself. UI tests should just find local (client/browser) issues in interacting with the API>

  12. PVince81 commented on Aug 3, 2017

    @PVince81
    Contributor

    moving to "planned" for later

  13. modified the milestones: , development on Aug 3, 2017
  14. PVince81 commented on Aug 18, 2017

    @PVince81
    Contributor

    Old endpoint:

    dav:/owncloud/remote.php/webdav/> mv welcome.txt .htaccess
    Moving `/owncloud/remote.php/webdav/welcome.txt' to `/owncloud/remote.php/webdav/.htaccess':  failed:
    403 Forbidden
    

    New endpoint:

    Moving `/owncloud/remote.php/dav/files/admin/welcome.txt' to `/owncloud/remote.php/dav/files/admin/.htaccess':  failed:
    404 Not Found
    

    It's a backend issue on the new endpoint, it should return 403 instead.

  15. PVince81 commented on Aug 18, 2017

    @PVince81
    Contributor

    Apparently these tests fail on master now, or they did before and I didn't notice.

    Anyway, here's the fix: #28735

  16. modified the milestones: development, on Aug 18, 2017
  17. lock commented on Aug 1, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  18. locked as resolved and limited conversation to collaborators on Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type:Bugp2-highstatus/STALE

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions