Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 4, 2025

When viewing photos on a publicly shared Maps instance, clicking on photo previews would fail with 401 Unauthorized errors:

GET https://domain.de/index.php/apps/files/api/v1/views 401 (Unauthorized)
PROPFIND https://domain.de/remote.php/dav/files/undefined/photo.JPG 401 (Unauthorized)

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 like remote.php/dav/files/undefined/... instead of the correct public share format public.php/dav/files/{token}/....

Solution:
Modified the photo viewer methods to detect public share context using getToken() and pass the shareToken parameter to the Viewer when appropriate:

const token = getToken()
if (token) {
    // For public shares, pass the share token to the Viewer
    OCA.Viewer.open({ 
        path: photo.path, 
        list: [photo],
        shareToken: token
    })
} else {
    // For logged-in users, use the standard approach
    OCA.Viewer.open({ path: photo.path, list: [photo] })
}

Components Updated:

  • PhotosLayer.vue: Updated viewPhoto and displayCluster methods
  • PhotoSuggestionsLayer.vue: Updated viewPhoto and displayCluster methods
  • PhotoSuggestionsSidebarTab.vue: Updated onListItemClick method

This fix follows the same pattern already used successfully in the getPreviewUrl method 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.

Copilot AI and others added 2 commits August 4, 2025 22:18
Co-authored-by: tacruc <402891+tacruc@users.noreply.github.com>
Co-authored-by: tacruc <402891+tacruc@users.noreply.github.com>
Copilot AI changed the title [WIP] [Bug]: Photos on public shared Maps cannot be displayed Fix photo viewer in public shared Maps by passing shareToken to Viewer Aug 4, 2025
Copilot AI requested a review from tacruc August 4, 2025 22:24
@tacruc tacruc marked this pull request as ready for review August 6, 2025 18:47
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]: Photos on public shared Maps cannot be displayed

2 participants