-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "fileids" virtual collection with file ids #28947
Conversation
Also note that regular Webdav clients do not like redirections:
In general the purpose of this endpoint is not to be able to browse inside the fileid folder but mostly to provide a way for the desktop/mobile client to resolve fileid back to the actual path. If this is not satisfactory, we could rather implement this with custom nodes and make these file ids be custom nodes that have only a propery "oc:redirect-to" with the correct URL. That would work too but be less close to the standard. (see https://www.ietf.org/rfc/rfc4437.txt) |
This PR also got a Jenkins problem with |
Would be good to consolidate this somehow with the new planned meta endpoint: #29087 |
GET meta/${fileid}/redirect ???? |
Yeah,maybe. Or call it "link" as it links to the source. |
|
Redirects any queries on "/meta/$fileId/link" to the matching DAV path inside of "files/$userId" if applicable. If the file id is not reachable or in trashbin, returns 404.
04ea3de
to
cb50009
Compare
@DeepDiver1975 I have adjusted this PR to use "/meta/$fileId/link". Please review and test. I'm not too happy about the implementation, but didn't find any other way. Please check the original post. |
Codecov Report
@@ Coverage Diff @@
## master #28947 +/- ##
============================================
- Coverage 62.09% 62.07% -0.03%
- Complexity 17515 17522 +7
============================================
Files 1045 1045
Lines 57746 57770 +24
============================================
- Hits 35859 35858 -1
- Misses 21887 21912 +25
Continue to review full report at Codecov.
|
Why not adding a IFile node to each MetaFileIdNode an within the get operation you trigger the redirect? |
With a plugin it doesn't work because you can't get the If using an IFile, how would you trick Sabre to return a redirect response when someone calls We could also decide to directly return the actual file's content, but the purpose of the endpoint is not to access the content but only to give clients a way to find out the real DAV path. |
Can we throw a redirect excpetion? |
Wouldn't that be even more hacky/dirty than my current approach ? |
I see that CorePlugin::httpGet requires an IFile. Maybe if I make that an INode it will skip the handler and run mine instead. I'll have another try with a plugin. |
Not sure whether we should keep this PR here now that we have #30383 which solves the original problem. I could imagine situations in which someone has a file id (not a private link) and would want to search for the matching file in Webdav. Hmmm search? |
Description
Redirects any queries on "fileids/$fileId" to the matching DAV path
inside of "files/$userId" if applicable. If the file id is not reachable
or in trashbin, returns 404.
Note, I'm not too happy that I couldn't put this into a plugin. The reason I couldn't is because I need to listen to the generic "beforeMethod" event. However in this weird way we implemented the DAV server plugins, we are already inside an existing generic "beforeMethod" event handler, so adding an additional generic handler does not work. The solution was to put the handler directly here.
Also, the "fileids" collection doesn't really exist. I could add it to make it visible in the root tree but it wouldn't have any children as it's not listable.
Related Issue
Fixes #28615
Motivation and Context
See ticket.
How Has This Been Tested?
curl -D - -X PROPFIND -u admin:admin http://localhost/owncloud/remote.php/dav/fileids/4
and check the "Location" header. Do this for a file and a folder.Then do this again for "fileids/4/sub/dir" where 4 is a subdir, the redirect points at the subdir.
Screenshots (if appropriate):
Types of changes
Checklist:
TODOs: