fix(files_external): set usePresignedUrl before first S3 connection - #63417
Conversation
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>
e9f3ec0 to
e914b68
Compare
|
/backport to stable34 |
|
/backport to stable33 |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
isUsePresignedUrl()could returnfalseeven withuse_presigned_urlconfigured, because the flag was only ever assigned insidegetConnection()— a lazy, on-demand S3 client init.preSignedUrl()checksisUsePresignedUrl()before callinggetConnection(), so on any request path that never opens a real S3 connection first (e.g. a WebDAV PROPFIND fordownloadURLthat only reads cached DB metadata), the flag was stuck at its defaultfalseand the presigned URL silently came back empty.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
use_presigned_url => trueon a primary S3 objectstore (or an S3 external storage mount){http://owncloud.org/ns}downloadURLwithout triggering any prior S3 read in the same request