Skip to content

hash in url in files app leads to root #14828

Closed

Description

@dttpy

Steps to reproduce

  1. create a folder "pics"
  2. upload a picture
  3. click and open this picture
  4. close this picture
  5. refresh the page

Expected behaviour

The page stays at the folder "pics", and the url should be

http://.../owncloud802/index.php/apps/files/?dir=%2Fpics

Actual behaviour

It goes back to the main page with the url:

http://.../owncloud802/index.php/apps/files/?dir=%2Fpic2#/pics/P100.JPG

Server configuration

Operating system: Ubuntu 13.10

Web server: apache 2.4.6 (Ubuntu)

Database: SQLite

PHP version: 5.5.3-1ubuntu2.3

ownCloud version: 8.0.2

Updated from an older ownCloud or fresh install: 8.0.0-beta2

List of activated apps: standard apps of owncloud

The content of config/config.php:

<?php
define('DEBUG',true);
$CONFIG = array (
  'instanceid' => 'oc6d9cda6e26',

  'datadirectory' => '/var/ocdata/.../owncloud/data8',
  'dbtype' => 'sqlite3',
  'version' => '8.0.2.0',
  'installed' => true,
  'theme' => '',
  'maintenance' => false,
  'maxZipInputSize' => 838860800,
  'allowZipDownload' => true,
  'loglevel' => '0',
  'trusted_domains' => 
  array (
    0 => '192.168.1.80',
  ),
  'appcodechecker' => false,


  );



Are you using external storage, if yes which one: no
Are you using encryption: yes

Client configuration

Browser: firefox 35.0.1

Operating system: ubuntu 13.10

Logs

Web server error log

ownCloud log (data/owncloud.log)

Browser log

Activity

  1. dttpy commented on Mar 12, 2015

    @dttpy
    Author
  2. DeepDiver1975 commented on Mar 12, 2015

    @DeepDiver1975
    Contributor

    @LukasReschke encoding fun? 🙊

  3. PVince81 commented on Mar 12, 2015

    @PVince81
    Contributor

    I don't think so.
    The strange thing is that if you remove everything behind the "#" and keep the hash, it works.

    I suspect that the URL parsing code is parsing too much.

  4. added this to the milestone on Mar 12, 2015
  5. dttpy commented on Mar 13, 2015

    @dttpy
    Author

    @PVince81 maybe this can help owncloud/gallery#50

  6. PVince81 commented on Mar 13, 2015

    @PVince81
    Contributor

    Even if the gallery app properly cleans up the URL, we still need to make sure to fix the parsing code

  7. rullzer commented on Apr 20, 2015

    @rullzer
    Contributor

    So it seems the files app is just not expecting any # in the url.
    The magic happens at https://github.com/owncloud/core/blob/master/apps/files/js/app.js#L49 which calls https://github.com/owncloud/core/blob/master/core/js/js.js#L1595 which calls https://github.com/owncloud/core/blob/master/core/js/js.js#L1572

    The # breaks the url because of the last function. Since that looks for the location of the # in the url. Normally this works because there is no # and all can be parsed as it should. But once there is a # only the last part gets parsed. And of course then it does not find valid stuff.

    This means the following URL will work:
    .....?#dir=

    So it seems the files app just abuses some functions that most of the time return the correct result.

  8. PVince81 commented on Apr 20, 2015

    @PVince81
    Contributor

    @rullzer the hash strategy is used as a workaround for IE8 that doesn't support changing the URL.
    You might have noticed that when you navigate into folders, only the URL changes. There is no full page reload. IE8 doesn't support that, so we have to abuse the hash part to be able to store the modified URL parts. This also means that the code in question needs to be able to parse URLs generated by IE8. Imagine if someone who has IE8 copies the URL from the browser and pastes it into Firefox (for whatever reasons), the URL still needs to work.

  9. rullzer commented on Apr 20, 2015

    @rullzer
    Contributor

    @PVince81 aaah good old ie8.
    Anyways, I just pointed out where it goes wrong and why. We could simply wait for IE8 support to be dropper. Maybe that is the easiest solution ;)

  10. PVince81 commented on Apr 20, 2015

    @PVince81
    Contributor

    I think if we'd remove the IE8 workaround, then it means that IE8 would be back to OC 5 behavior: refresh the whole browser page when navigating. IE8 users are probably already used to sub-par user experience 😉

  11. oparoz commented on Apr 21, 2015

    @oparoz
    Contributor

    While the parseHashQuery() method still needs to be fixed, the specific problem described in the OP has been fixed in Gallery+, in master for now.

  12. PVince81 commented on Apr 23, 2015

    @PVince81
    Contributor

    Setting severity to low as there's an easy workaround

  13. ghost added this to the milestone on May 11, 2015
  14. ghost removed this from the milestone on May 11, 2015
  15. oparoz commented on Jun 30, 2015

    @oparoz
    Contributor

    Coming back to this as it's breaking the Files app when users use the browser's forward button.
    With lots of workarounds it's possible to make the slideshow not break when the back button is hit, but we have no control on the URL the user has just left and if he ever presses forward, the app is reset.

  16. PVince81 commented on Jun 30, 2015

    @PVince81
    Contributor

    Yes... maybe we need a way for apps to define URL routes in JS so we could reroute requests to them.
    And instead of using hashes hacks, use real actual URLs for file viewers. (only IE8 would not approve and require special workarounds)

  17. PVince81 commented on Sep 17, 2015

    @PVince81
    Contributor

    Ok, actually the file list should make sure that onPopstate doesn't trigger a folder change event if it's the same folder. That might help fixing it.

  18. PVince81 commented on Sep 17, 2015

    @PVince81
    Contributor

    Similar issue: #19120 (comment)

  19. PVince81 commented on Sep 28, 2015

    @PVince81
    Contributor

    Fix is here: #19418

    Now also reproducible with the next text editor, when closing the editor then refreshing the page.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions