-
Notifications
You must be signed in to change notification settings - Fork 17
Fix url links to lucene result page with OC 9.1 #124
Conversation
The issue is that lucene generates this type of url: http://domain.com/files/index.php?dir=%2FDocuments&file=Example.odt and OC 9.1 wants this: http://domain.com/remote.php/webdav/Documents/Example.odt
@flaracca, thanks for your PR! By analyzing the history of the files in this pull request, we identified @butonic, @VicDeo and @icewind1991 to be potential reviewers. |
Well it depends what we want the behavior to be... The URL http://domain.com/files/index.php?dir=%2FDocuments&file=Example.odt should still be valid in 9.1 (although I thought "file" shuld be "scrollto"). This would display the file within the file list. But changing it to the Webdav URL would trigger a download instead of displaying it in the list. |
Even better would be to change it to a permalink: http://localhost/owncloud/index.php/f/$fileid |
Currently all search results are user specific and searching in shared files is not yet implemented in search_lucene. Resolving a user specific path is nod yet necessardy. Nevertheless the link generation suffered bitrot. For files the link should point to the containing directory and scroll to the file. For directories, the link should just point to the directory. Or in php:
@flaracca could you test with the above snippet? |
@butonic What are your security concerns with a fileID in the url? |
@butonic then we'd need to get rid of the permalinks feature completely, because that's how it works, see owncloud/core#24434 which was approved before. Also note that the internal fileid can be found by inspecting the "tr" rows in the file list. The permissions are checked, yes. Only users who have access to that file will get a view. The check is done through a call that basically says "tell me which path this fileid has for the currently logged in user" (because the path can be different for share recipients). If the user has no access to the file, it gets a "Not found" error. |
also: permalinks only work for logged in users |
just call me paranoid. In the back of my mind a voice said 'don't expose internal ids or you will never get rid of them'. I tried to find a better explation, eg a blog article but could only come up with stackoverflow. ANd the answers are all about security concerns. AFAICT we will need to identify files by storage id and fileid ... but thats a different topic. Nevermind, lets focus on getting the right link here ... |
The issue is that lucene generates this type of url:
http://domain.com/files/index.php?dir=%2FDocuments&file=Example.odt
and OC 9.1 wants this:
http://domain.com/remote.php/webdav/Documents/Example.odt