Skip to content

fix(core): strip trailing slash from companionUrl for socket URL - #6391

Open
JammingBen wants to merge 3 commits into
transloadit:mainfrom
JammingBen:fix/socket-host-trailing-slash
Open

fix(core): strip trailing slash from companionUrl for socket URL#6391
JammingBen wants to merge 3 commits into
transloadit:mainfrom
JammingBen:fix/socket-host-trailing-slash

Conversation

@JammingBen

Copy link
Copy Markdown

A trailing slash produced ws://host//api/<token>, which Companion's router rejects, so remote uploads hung until the socket timeout. Strip it to make the implementation more robust.

@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2608105

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@uppy/core Patch
uppy Patch

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

@mifi

mifi commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

how did you reproduce this? how did you get the trailing slash? also, would it be possible to sign your commits, as we require all commits to be signed?

@JammingBen
JammingBen force-pushed the fix/socket-host-trailing-slash branch from 3a8ebf7 to 3302f28 Compare August 9, 2026 13:41
@JammingBen

Copy link
Copy Markdown
Author

how did you reproduce this? how did you get the trailing slash?

I passed a companionUrl with a trailing slash to the WebDAV companion plugin: https://uppy.io/docs/webdav, resulting in errors when trying to connect to companion. I didn't try with other plugins, but it seemed like a general issue to me.

also, would it be possible to sign your commits, as we require all commits to be signed?

Yep I just pushed again, should be signed now.

@mifi

mifi commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

note to self: look into whether we can validate it early instead, and give an error if a trailing slash is passed

…t urls

Move RequestClient's private stripSlash into a shared stripTrailingSlash
util so the websocket URL and the HTTP URLs normalize identically, and
strip repeated trailing slashes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@mifi mifi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The socket URL now goes through the same shared stripTrailingSlash helper as the HTTP URLs (and strips repeated slashes) rather than erroring on a trailing slash, because RequestClient.hostname has always silently tolerated one for every HTTP endpoint — so validating would break apps that work fine today, in a patch release.

@mifi
mifi requested a review from remcohaszing August 10, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants