Fix photo viewer in public shared Maps by passing shareToken to Viewer #1437
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.
When viewing photos on a publicly shared Maps instance, clicking on photo previews would fail with 401 Unauthorized errors:
The issue occurred because the Viewer component was being called without the public share context, causing it to attempt file access using standard user-based DAV paths instead of public share paths.
Root Cause:
The
OCA.Viewer.open()calls in photo-related components were not passing the share token when in a public share context. This resulted in the Viewer trying to construct URLs likeremote.php/dav/files/undefined/...instead of the correct public share formatpublic.php/dav/files/{token}/....Solution:
Modified the photo viewer methods to detect public share context using
getToken()and pass theshareTokenparameter to the Viewer when appropriate:Components Updated:
PhotosLayer.vue: UpdatedviewPhotoanddisplayClustermethodsPhotoSuggestionsLayer.vue: UpdatedviewPhotoanddisplayClustermethodsPhotoSuggestionsSidebarTab.vue: UpdatedonListItemClickmethodThis fix follows the same pattern already used successfully in the
getPreviewUrlmethod for photo thumbnails, ensuring consistency across the codebase. The behavior for logged-in users remains unchanged.Fixes #1436.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.