Skip to content

fix(files_external): set usePresignedUrl before first S3 connection - #63417

Open
mosi-kha wants to merge 1 commit into
nextcloud:masterfrom
mosi-kha:fix/s3-presigned-url-flag-not-set
Open

fix(files_external): set usePresignedUrl before first S3 connection#63417
mosi-kha wants to merge 1 commit into
nextcloud:masterfrom
mosi-kha:fix/s3-presigned-url-flag-not-set

Conversation

@mosi-kha

Copy link
Copy Markdown
Contributor

Summary

  • isUsePresignedUrl() could return false even with use_presigned_url configured, because the flag was only ever assigned inside getConnection() — a lazy, on-demand S3 client init.
  • preSignedUrl() checks isUsePresignedUrl() before calling getConnection(), so on any request path that never opens a real S3 connection first (e.g. a WebDAV PROPFIND for downloadURL that only reads cached DB metadata), the flag was stuck at its default false and the presigned URL silently came back empty.
  • Moves the assignment into parseParams(), which runs at construction time for both primary S3 storage and S3 external storage, so the flag is correct from the start regardless of connection state.

Fixes #59249

Test plan

  • Configure use_presigned_url => true on a primary S3 objectstore (or an S3 external storage mount)
  • PROPFIND a file for {http://owncloud.org/ns}downloadURL without triggering any prior S3 read in the same request
  • Confirm a presigned URL is now returned instead of an empty value

@mosi-kha
mosi-kha requested a review from a team as a code owner August 19, 2026 14:17
@mosi-kha
mosi-kha requested review from icewind1991, leftybournes, salmart-dev and sorbaugh and removed request for a team August 19, 2026 14:17
isUsePresignedUrl() was read by preSignedUrl() before getConnection()
ever ran, since the flag was only assigned as a side effect inside
getConnection(). Any request path that never opens a real S3 client
(e.g. a PROPFIND that only reads cached DB metadata) saw the flag
stuck at its default false, so downloadURL/download-url-expiration
came back empty even with use_presigned_url configured.

Move the assignment into parseParams(), which runs at construction
time for every S3 backend (primary storage and external storage),
so the flag is correct regardless of whether a connection was ever
opened.

Fixes nextcloud#59249

Signed-off-by: mostafa <mostafakhaki00@gmail.com>
@mosi-kha
mosi-kha force-pushed the fix/s3-presigned-url-flag-not-set branch from e9f3ec0 to e914b68 Compare August 19, 2026 14:21
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.

[Bug]: NC33's presigned URLs are not working

1 participant