@uppy/companion: support oCIS public share links in the WebDAV provider#6333
Open
dj4oC wants to merge 1 commit into
Open
@uppy/companion: support oCIS public share links in the WebDAV provider#6333dj4oC wants to merge 1 commit into
dj4oC wants to merge 1 commit into
Conversation
Companion's WebDAV provider hard-coded the /public.php/webdav/ endpoint when resolving /s/<token> public share links. That works for Nextcloud and ownCloud 10, but oCIS (ownCloud Infinite Scale) serves public shares at /dav/public-files/<token>, so importing an oCIS public link failed with "Invalid response: No root multistatus found". Probe the known public-share WebDAV endpoints and use the first that answers as WebDAV, caching the resolved endpoint on the session so later list/download requests don't re-probe. This fixes oCIS public links without changing behavior for Nextcloud / ownCloud 10. Fixes transloadit#6007. Addresses transloadit#6117. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: David Walter <david.walter@kiteworks.com>
🦋 Changeset detectedLatest commit: 6011ef1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Author
|
@qxprakash @Murderlon @mifi would you mind to review this one? Thank you very much |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Companion's WebDAV provider resolves Nextcloud/ownCloud/oCIS public share links (
https://host/s/<token>) to a single hard-coded WebDAV endpoint,/public.php/webdav/:https://github.com/transloadit/uppy/blob/main/packages/@uppy/companion/src/server/provider/webdav/index.ts
That path works for Nextcloud and ownCloud 10, but oCIS (ownCloud Infinite Scale) serves public shares at
/dav/public-files/<token>. Hitting/public.php/webdav/on oCIS returns an HTML page instead of a207 Multi-Status, so the import fails with:Fixes #6007. As discussed in #6117, there is no standard WebDAV (or reliably-shaped capabilities) way to discover the correct public-share path across servers.
Fix
When a public share link is detected, probe the known public-share WebDAV endpoints and use the first that actually responds as WebDAV (a cheap depth-0
PROPFIND); hitting the wrong endpoint throwsNo root multistatus found, so we move on to the next candidate:/public.php/webdav/— Nextcloud, ownCloud 10/dav/public-files/<token>— oCISThe resolved endpoint is cached on the session (
publicLinkUrl) so subsequentlist/downloadrequests don't re-probe. Behavior for Nextcloud / ownCloud 10 is unchanged (their endpoint is the first candidate and matches immediately); oCIS now works via the fallback. If no candidate answers as WebDAV, it falls back to the previous default endpoint so the original, meaningful error still surfaces.This is the "probe the oCIS endpoint alongside the current path" approach proposed in #6117, and it generalizes cleanly if more server-specific endpoints need to be added later.
Testing
Added
packages/@uppy/companion/test/webdav.test.tscovering the resolver:/public.php/webdav/(oCIS endpoint never probed)/dav/public-files/<token>(ownCloud path probed first)publicLinkUrlis reused without re-probing/index.phpis stripped from the base URL/s/URL throwsyarn workspace @uppy/companion testpasses (124 tests),yarn workspace @uppy/companion typecheckis clean, and Biome is clean on the changed files. A changeset is included (@uppy/companionpatch).