Skip to content

Conversation

@itslenny
Copy link
Contributor

@itslenny itslenny commented Nov 17, 2025

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Paths returned by TUS during multi-part uploads include a duplicate slash when adding the forwarded path prefix

Example: /storage/v1//upload/resumable/abc123

What is the new behavior?

Remove duplicate slash (/storage/v1/upload/resumable/abc123)

Additional context

Thanks for the report @aantti

@coveralls
Copy link

coveralls commented Nov 17, 2025

Pull Request Test Coverage Report for Build 20041649574

Details

  • 3 of 5 (60.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.004%) to 75.923%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/http/routes/tus/lifecycle.ts 1 3 33.33%
Files with Coverage Reduction New Missed Lines %
src/http/routes/tus/lifecycle.ts 1 80.44%
Totals Coverage Status
Change from base Build 19835797812: -0.004%
Covered Lines: 25414
Relevant Lines: 33194

💛 - Coveralls

const forwardedPath = req.headers['x-forwarded-prefix']
if (requestAllowXForwardedPrefix && typeof forwardedPath === 'string') {
basePath = forwardedPath + path
// Remove trailing slash from forwardedPath to avoid double slashes

Choose a reason for hiding this comment

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

Similar pattern could happen for signV4 of canonical request if this feature requestAllowXForwardedPrefix is enabled or a configuration value ending with a slash is given. I believe, as a result, it can cause SignatureDoesNotMatch errors

Copy link

Choose a reason for hiding this comment

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

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. This (and the original issue) does not impact our hosted service because we do not have a trailing slash, but for self hosted people may want to configure it (nginx, envoy, etc) with a trailing slash and that would cause S3 signature mismatch.

@aantti aantti changed the title fix: remove deuplicate slash in tus upload url generator fix: remove duplicate slash in tus upload url generator Nov 22, 2025
@itslenny itslenny force-pushed the fix/strip-extra-slash-from-tus-path branch from 1251a82 to 8e5c8cc Compare December 8, 2025 20:21
@itslenny itslenny requested a review from fenos December 8, 2025 22:02
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.

5 participants