Skip to content

Conversation

@skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Aug 7, 2025

Summary

If a file have been removed or a share is not accessible anymore, the server will still try to download an the browser will sometimes download an empty index.html
image

This ensure we show a nice error and refresh the list if something goes wrong

image

Checklist

@skjnldsv skjnldsv added this to the Nextcloud 32 milestone Aug 7, 2025
@skjnldsv skjnldsv self-assigned this Aug 7, 2025
@skjnldsv skjnldsv added the bug label Aug 7, 2025
@skjnldsv skjnldsv requested a review from a team as a code owner August 7, 2025 09:33
@skjnldsv skjnldsv added the 3. to review Waiting for reviews label Aug 7, 2025
@skjnldsv skjnldsv requested review from susnux and removed request for a team August 7, 2025 09:33
@skjnldsv skjnldsv requested review from nfebe and sorbaugh August 7, 2025 09:33
@skjnldsv
Copy link
Member Author

skjnldsv commented Aug 7, 2025

/backport to stable31

@skjnldsv
Copy link
Member Author

skjnldsv commented Aug 7, 2025

/backport to stable30

Comment on lines 142 to 144
// Try to reload the current directory to update the view
const directory = getCurrentDirectory(view, dir)!
emit('files:node:updated', directory)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels weird to have this in a download action - meaning all the logic to get the directory. This smells like duplication. We rather should do this properly from either the files list or the store.

But in this case why not just remove that one file, there you do not need any logic not related to downloading here (files:node:deleted).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in this case why not just remove that one file, there you do not need any logic not related to downloading here (files:node:deleted).

For the single action, sure, it make sense! 👍
Regarding the batch one, it's a bit frustrating but yeah, we need to reload the full directory as we don't know which object failed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meaning all the logic to get the directory. This smells like duplication. We rather should do this properly from either the files list or the store.

Ideally, the directory should be part of the action exec parametters, we discussed it in the past and still haven't done anything with it 🙈

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that would not really help here as then you still need to fetch the new content.
What I meant is to get rid of all non download related logic, so the only thing that would be needed here is call a trigger for reloading - instead of needing to fetch the directory in unrelated places.

Because currently it relys on the side effect, that if the current directory is changed the content is reloaded, maybe we should somehow provide the fetchContent method (similar like we provide it to the bread crumbs it could be an files:list:reload event).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't get me wrong, I 100% agree, the way we trigger a reload is not great.
Luckily it's still used relatively sparingly, but imho the issue is needing that event in the first place :)
I'd be happy to sit and discuss real solutions on how to avoid the need of such reloads.

@skjnldsv skjnldsv force-pushed the fix/download-action branch from f9487ce to 560be2c Compare August 7, 2025 10:35
Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a fix this is fine I guess - as all other solutions would need new events.

@skjnldsv skjnldsv force-pushed the fix/download-action branch 3 times, most recently from bc9464d to bb82dd4 Compare August 7, 2025 12:54
This was referenced Aug 22, 2025
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@AndyScherzinger
Copy link
Member

/compile

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@AndyScherzinger AndyScherzinger merged commit 1cb6dc0 into master Aug 28, 2025
126 checks passed
@AndyScherzinger AndyScherzinger deleted the fix/download-action branch August 28, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants