Repository navigation
Description
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
- User1 shares a folder "test folder" with User2
- User1 wants to send a link to a subfolder or file, for example: "test folder/subdir/coolfile.odt"
- 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"
- User1 sends an email with the link
- 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:
- User1 shares a folder "test folder" with User2
- User1 wants a link pointing to "test folder/subdir" to send to User2
- User1 enters "test folder/subdir" and clicks an anchor icon, which copies the link "index.php/files?id=12345" that points to "subdir"
- User1 pastes the link in an email dialog with User2
- User2 opens the link
- System checks whether User2 has access to the file with id 12345 through any shares
- System resolves the file id to the path related to User2
- 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
Activity
PVince81 commentedon Oct 23, 2014
For the design part, the question is where can the user get access to the permalink.
There are multiple possibilities:
jancborchardt commentedon Oct 23, 2014
Not another action please. It will only confuse people about what it actually does.
Nope, same as above.
Honestly copying the link/URL is fine in this case and is the thing which should be optimized.
PVince81 commentedon Oct 23, 2014
Ok, then option 4. is probably the best.
Make the URL always include the file id to make it copiable.
LukasReschke commentedon Oct 23, 2014
Yes. That would make most sense!
Very cool proposal! - I see a lot of very good use-cases for that.
PVince81 commentedon Oct 31, 2014
Note: would volunteer to implement this myself.
jbtbnl commentedon Oct 31, 2014
What about the following use-case:
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.
PVince81 commentedon Oct 31, 2014
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)
PVince81 commentedon Nov 4, 2014
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.
jbtbnl commentedon Nov 5, 2014
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.
jancborchardt commentedon Nov 6, 2014
I would say the absolute linking with just a clear name is ok. If stuff is renamed, then it’s renamed.
PVince81 commentedon Jan 13, 2015
Found a few situations where the file id isn't stable: #13310
PVince81 commentedon Mar 25, 2015
@MTRichards
26 remaining items
MorrisJobke commentedon May 4, 2016
Okay. This means, that it is not a redirect, but simply shows the content. 👍
PVince81 commentedon May 4, 2016
PR here (still WIP): #24434
I see additional tricky challenges with "fileid" in the regular URL:
PVince81 commentedon May 4, 2016
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)
PVince81 commentedon May 4, 2016
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.
PVince81 commentedon May 4, 2016
Okay, I found a way: #24434 (comment)
Please try it out!
PVince81 commentedon May 6, 2016
Possible extensions:
PVince81 commentedon May 10, 2016
@MTRichards @cmonteroluque @jospoortvliet @carlaschroder this feature was merged for 9.1 !
jospoortvliet commentedon May 10, 2016
Congrats, this is very cool!
MTRichards commentedon May 10, 2016
Awesome!
PVince81 commentedon Jun 30, 2016
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.
lock commentedon Aug 4, 2019
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.