Skip to content

Conversation

@tabedzki
Copy link
Contributor

@tabedzki tabedzki commented Sep 26, 2025

Fix: Added the dirPath to the node.path for file comparisons in public shares, enabling the image viewer to function correctly when accessing images within subfolders. This resolves the issue where users could not navigate through images in subfolders when sharing the parent folder publicly.

I couldn't get the alternative of using fileid attribute for both working for whatever reason.

Fixes #2977. Fixes #2976. Fixes #2990.

Description of bug:

In commit cce1e1d, a new sort was introduced that compared node.path to file.filename. In a public file share, the node.dirname is evaluating to / even within a subfolder so node.path (which seems to be${node.dirname}${node.basename}) is always /${node.basename}.

However,file.filename is dirPath/displayname. Thus, if one attempts to scroll through in the top level of a public share, node.path is the same as file.filename since dirPath is node.dirname, that is /. In a subfolder path, this isn't true. Since we are unable to change the path for the NcFile, I appended the dirPath during the filter.

Alternative fixes:

Alternatively, the better approach would be rectify the path variable for the NcFile but I didn't see a method to do that.

Testing

I tested this using the dev repo (https://github.com/juliusknorr/nextcloud-docker-dev) and copied all the files from Media into a subfolder called images and shared the Media folder using a public link to get the following:

Using Big_Buck_Bunny_1080_10s_10MB.mkv in Media:

logger.error(`sortedNode.path: ${String(sortedNodes[0].path)}`) // /Big_Buck_Bunny_1080_10s_10MB.mkv
logger.error(`sortedNode.filename: ${String(sortedNodes[0].filename)}`) // /Big_Buck_Bunny_1080_10s_10MB.mkv

Using Big_Buck_Bunny_1080_10s_10MB.mkv in Media/images:

logger.error(`sortedNode.path: ${String(sortedNodes[0].path)}`) // /Big_Buck_Bunny_1080_10s_10MB.mkv
logger.error(`sortedNode.filename: ${String(sortedNodes[0].filename)}`) // /images/Big_Buck_Bunny_1080_10s_10MB.mkv

tree .

.
|-- Media
|   |-- Big_Buck_Bunny_1080_10s_10MB.mkv
|   |-- images
|   |   |-- Big_Buck_Bunny_1080_10s_10MB.mkv
|   |   |-- photo-1495962637988-4be9db2af01f.jpeg
|   |   |-- photo-1498855592392-af2bf1e0a4c7.jpeg
|   |   |-- photo-1503991721143-75f95ebf1e55.jpeg
|   |   |-- photo-1517603250781-c4eac1449a80.jpeg
|   |   |-- photo-1527668441211-67a036f77ab4.jpeg
|   |   |-- photo-1532597751369-606119ceda8a.jpeg
|   |   `-- photo-1533658925625-2f94d23fc425.jpeg
|   |-- photo-1495962637988-4be9db2af01f.jpeg
|   |-- photo-1498855592392-af2bf1e0a4c7.jpeg
|   |-- photo-1503991721143-75f95ebf1e55.jpeg
|   |-- photo-1517603250781-c4eac1449a80.jpeg
|   |-- photo-1527668441211-67a036f77ab4.jpeg
|   |-- photo-1532597751369-606119ceda8a.jpeg
|   `-- photo-1533658925625-2f94d23fc425.jpeg
|-- Nextcloud_Server_Administration_Manual.pdf
`-- Templates

@tabedzki
Copy link
Contributor Author

Also, can we backport this to the stable 30? I experienced this issue on 30.0.1.

@tabedzki
Copy link
Contributor Author

tabedzki commented Oct 1, 2025

Hi @skjnldsv,
Welcome back! When you've had the chance to catch up, can you review this PR? It addresses a bug that affects my setup and closes two open issues. If you don’t have bandwidth right now, is there someone else on the team who could review?

@provokateurin provokateurin requested review from a team, nfebe, skjnldsv and susnux and removed request for a team October 6, 2025 07:56
@tabedzki tabedzki force-pushed the filter-bug-shared-subfolder branch from ebbf638 to bc8a650 Compare October 7, 2025 13:35
@jonas2515
Copy link

Thank you! Can confirm that fix works for me..

…n subfolders in a file share. Previously, node.path for files ina a shaer were `/${file.basename}`

Fixes nextcloud#2977
Fixes nextcloud#2976
@tabedzki tabedzki force-pushed the filter-bug-shared-subfolder branch from bc8a650 to ab52cab Compare October 8, 2025 15:36
@tabedzki tabedzki changed the title Fix image viewer functionality for public shares in subfolders fix(viewer): address file path composition for subfolders in public shares Oct 8, 2025
@tabedzki
Copy link
Contributor Author

tabedzki commented Oct 9, 2025

Hi @skjnldsv, I'm looking forward to the next major version of the Viewer app in development!
Do you know if it would address the issues this PR fixes?

As a stopgap, when do you think you or one of your colleagues might be able to review and backport this fix?
Thanks!

@github-actions
Copy link

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

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.)

@skjnldsv
Copy link
Member

Hey @tabedzki thanks for the PR and for the additional pings, it's been merged in #2991
and backported to 32, 31 & 30!

@tabedzki tabedzki deleted the filter-bug-shared-subfolder branch October 20, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug Something isn't working feedback-requested

Projects

None yet

5 participants