Skip to content

Permalinks for folders and files that work across internal users when sharing #11732

Closed

Description

@PVince81

The main use case is being able to easily copy/paste/share links to any shared folder/subfolder/files inside of ownCloud between users, independently from their location.

Current problems with internal folder links

Paths inside links are not consistent across users.

In OC 6

  1. User1 shares a folder "test folder" with User2
  2. User1 wants to send a link to a subfolder or file, for example: "test folder/subdir/coolfile.odt"
  3. User1 copies the browser URL "index.php/files?dir=test%20folder/subdir", then prepends "/Shared" since User2 will have it appear there, the link becomes "index.php/files?dir=Shared/test%20 folder/subdir"
  4. User1 sends an email with the link
  5. User2 opens the link, which shows the correct folder

Problem: for owner the path inside the link is "/test folder/subdir" but for any other user it's "/Shared/test folder/subdir".

In OC 7

Since OC 7 is is now possible for User2 to store "test folder" anywhere in their ownCloud, so the link "files?dir=Shared/test%20folder/subdir" will not work any more.

Problem: every user can potentially require a completely different path inside the links, and the target path is not predictable. It is not possible to paste a single link in a group email. You'd need to send an individual link to every one.

Extended use case

If User1 moved "subdir" to another location inside that share, the link will not be valid any more for neither User1 or User2.

Introducing permalinks

Concept

Currently, files and folders all have an internal file id which doesn't change most of the time (to be discussed).

The idea is to introduce a new format for link, with the form: "index.php/files?id=12345" where 12345 is the file id of the file or folder.

The workflow would be as follows:

  1. User1 shares a folder "test folder" with User2
  2. User1 wants a link pointing to "test folder/subdir" to send to User2
  3. User1 enters "test folder/subdir" and clicks an anchor icon, which copies the link "index.php/files?id=12345" that points to "subdir"
  4. User1 pastes the link in an email dialog with User2
  5. User2 opens the link
  6. System checks whether User2 has access to the file with id 12345 through any shares
  7. System resolves the file id to the path related to User2
  8. System redirects the browser to the matching path, for example "index.php/files?dir=allshareswithuser2/test%20folder/subdir".

If User1 moves "subdir" to another location inside of the "test folder" share, the folder will still be accessible with the link "index.php/files?id=12345".

For a file "coolfile.odt", the link would resolve to "index.php/files?dir=test%folder/subdir&scrollto=coolfile.odt" (for now, until we have direct links to files)

Possible extensions

The activity app, for example, could also make use of such permalinks to make sure

Potential problems

Link format not user readable

The link itself would not contain the file name/subdir any more but just the id, which is not user friendly as one cannot easily distinguish links. On the other hand: this is already how it's done for public links. Possible solution: add a dummy parameter in the link with the full path, but the parameter is ignored by the system.

Preserving the file id

We need to make sure that all file operations will preserve the file id.

  • As far as I know most basic operations should preserve the file id, which includes renaming, moving.
  • Not sure about upload+overwrite, moving between storages.
  • Moving between shared folders will most likely NOT preserve the file id, but that might be ok as the sharing information will change as well.
  • Deleting, then restoring files will NOT preserve the file id
  • ... more research required

I think this would be a nice improvement to solve the age-old question "how can I easily get a link to any folder inside ownCloud and share that link with other internal users ? (without having to fiddle with the URL...)"

@owncloud/designers @MTRichards @karlitschek @craigpg

@icewind1991 @schiesbn for file id questions

CC @LukasReschke

Activity

  1. PVince81 commented on Oct 23, 2014

    @PVince81
    ContributorAuthor

    For the design part, the question is where can the user get access to the permalink.
    There are multiple possibilities:

    1. Make the anchor tag of the file/folder point to the file id instead of the file name, this makes it copiable with right click + copy
    2. Add a new "Link to this" action in the file row (might be too flashy)
    3. Add an anchor link in the controls bar "permalink".
    4. Simply add the current folder id in the URL: "index.php/files?dir=currentdir&id=1234". When resolving the link it will first try with the id. If it doesn't exist, it will fall back to using "dir".
  2. jancborchardt commented on Oct 23, 2014

    @jancborchardt
    Contributor

    2 Add a new "Link to this" action in the file row (might be too flashy)

    Not another action please. It will only confuse people about what it actually does.

    3 Add an anchor link in the controls bar "permalink".

    Nope, same as above.

    Honestly copying the link/URL is fine in this case and is the thing which should be optimized.

  3. PVince81 commented on Oct 23, 2014

    @PVince81
    ContributorAuthor

    Ok, then option 4. is probably the best.
    Make the URL always include the file id to make it copiable.

  4. LukasReschke commented on Oct 23, 2014

    @LukasReschke
    Contributor

    Yes. That would make most sense!

    Very cool proposal! - I see a lot of very good use-cases for that.

  5. PVince81 commented on Oct 31, 2014

    @PVince81
    ContributorAuthor

    Note: would volunteer to implement this myself.

  6. self-assigned this
    on Oct 31, 2014
  7. jbtbnl commented on Oct 31, 2014

    @jbtbnl
    Contributor

    What about the following use-case:

    1. User shares folder "/latest" with some people
    2. User develops a new version of the software in "/dev"
    3. User renames "/latest" to "/v1" and "/dev" to "/latest"

    Now the user might assume that the link will still work, because the dummy variable shows the path to the latest version of the software. The link indeed still works, but now the people the link was originally shared with cannot reach the latest software.

    A kind of a solution would be to only include the folder name (without the full path) in the link.

  8. PVince81 commented on Oct 31, 2014

    @PVince81
    ContributorAuthor

    True, but there are use cases where even the target name might change.
    We could also have only the file id in the URL, but then the links would be indistinguishable. (but I guess that's also how Google docs works, their pathes are only hashes, similar to OC's public links)

  9. PVince81 commented on Nov 4, 2014

    @PVince81
    ContributorAuthor

    Another problem that it solves is that activities are pointing to specific folders, so when scrolling back in time one won't be able to directly access to files that might have been moved. If the activity app could provide such permalinks, renamed/moved files would still be accessible.

  10. jbtbnl commented on Nov 5, 2014

    @jbtbnl
    Contributor

    There is definitely a use case for both, but which one should be the default? I'd say the permalink could be the default, with an option for absolute links.

    Not sure if @jancborchardt will be happy with two linking options in the UI though 😄
    But removing (new) absolute linking would be a regression for users that are already accustomed to it.

  11. jancborchardt commented on Nov 6, 2014

    @jancborchardt
    Contributor

    I would say the absolute linking with just a clear name is ok. If stuff is renamed, then it’s renamed.

  12. PVince81 commented on Jan 13, 2015

    @PVince81
    ContributorAuthor

    Found a few situations where the file id isn't stable: #13310

  13. PVince81 commented on Mar 25, 2015

    @PVince81
    ContributorAuthor
  14. 26 remaining items

  15. MorrisJobke commented on May 4, 2016

    @MorrisJobke
    Contributor

    For now I intend to support both, the code addition is minimal.

    Okay. This means, that it is not a redirect, but simply shows the content. 👍

  16. PVince81 commented on May 4, 2016

    @PVince81
    ContributorAuthor

    PR here (still WIP): #24434

    I see additional tricky challenges with "fileid" in the regular URL:

    • non "All files" views like "Shared with me" handling
    • browser back button with history API: JS code needs to decide whether to use the fileid (might be obsolete ?) or "dir" argument
    • auto-adding "fileid" in the URL from the server without causing redirect loop: might rely on JS code to add it instead
  17. PVince81 commented on May 4, 2016

    @PVince81
    ContributorAuthor

    Okay. This means, that it is not a redirect, but simply shows the content

    At the moment it is a redirect to the correct folder (in case the folder changed name or so).
    Making it display the correct folder is much more complex: the JS code would need an API to resolve fileid to folder, and then do its PROPFIND and possibly also replace the URL with the correct one (which has almost the same result as a redirect)

  18. PVince81 commented on May 4, 2016

    @PVince81
    ContributorAuthor

    Hmm looks like keeping this extra "fileid" argument up to date in the URL requires deeper changes in the JS code:
    There's a delay between "load this folder" and before we can know the file id. So we cannot change the URL directly and have to wait until loading is done. (in the past the URL was changed first in case loading fails the user can just reload the page). This is especially relevant because the fileid isn't always known. Here are some cases:
    - initial page load on folder with unknown fileid: fileid becomes known after PROPFIND
    - clicking on a folder to nav into it: fileid is known at click time (data-id)
    - clicking on a breadcrumb: fileid not known until after PROPFIND

    Trying to find a way around this and limit regression risks.

  19. PVince81 commented on May 4, 2016

    @PVince81
    ContributorAuthor

    Okay, I found a way: #24434 (comment)

    Please try it out!

  20. PVince81 commented on May 6, 2016

    @PVince81
    ContributorAuthor

    Possible extensions:

  21. modified the milestones: , backlog on May 10, 2016
  22. PVince81 commented on May 10, 2016

    @PVince81
    ContributorAuthor

    @MTRichards @cmonteroluque @jospoortvliet @carlaschroder this feature was merged for 9.1 !

  23. jospoortvliet commented on May 10, 2016

    @jospoortvliet

    Congrats, this is very cool!

  24. MTRichards commented on May 10, 2016

    @MTRichards
    Contributor

    Awesome!

  25. PVince81 commented on Jun 30, 2016

    @PVince81
    ContributorAuthor

    A nice addition would be to make it possible to request access to a file one doesn't have access to: #25317

    This could happen if someone shared the permalink by email to lots of people.

  26. lock commented on Aug 4, 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.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions