Skip to content

fix(files): uri encode node source#61494

Open
leftybournes wants to merge 1 commit into
masterfrom
leftybournes/fix/files-uri-encode-node-source
Open

fix(files): uri encode node source#61494
leftybournes wants to merge 1 commit into
masterfrom
leftybournes/fix/files-uri-encode-node-source

Conversation

@leftybournes

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

Node sources that aren't url-encoded are compared against their url-encoded counterparts. Ensure that both are url-encoded so that a fair comparison is made. This fixes an issue with files lists still showing a .md file in the list after deleting it in the editor.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@leftybournes leftybournes added this to the Nextcloud 35 milestone Jun 22, 2026
@leftybournes leftybournes requested a review from skjnldsv as a code owner June 22, 2026 13:15
@leftybournes leftybournes added the 3. to review Waiting for reviews label Jun 22, 2026
@leftybournes leftybournes requested a review from a team as a code owner June 22, 2026 13:15
@leftybournes leftybournes added the team: Files Code maintained by 📁 Files team label Jun 22, 2026
@leftybournes leftybournes requested review from nfebe and susnux and removed request for a team June 22, 2026 13:15
Signed-off-by: Kent Delante <kent@delante.me>

Node sources that aren't url-encoded are compared against their
url-encoded counterparts. Ensure that both are url-encoded so that a
fair comparison is made. This fixes an issue with files lists still
showing a .md file in the list after deleting it in the editor.
@leftybournes leftybournes force-pushed the leftybournes/fix/files-uri-encode-node-source branch from 4cc986d to e50f4ea Compare June 22, 2026 13:18
function deleteNodes(nodes: INode[]) {
const entries = Object.entries(files.value)
.filter(([, node]) => !nodes.some((n) => n.source === node.source))
.filter(([, node]) => !nodes.some((n) => n.source === encodeURI(node.source)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why should there be ever a case of uri-encoded source? The source has to be not URI encoded.

If you need the URI encoded source, use node.encodedSource.

IF there are cases with URI encoded source, then those cases need to be fixed.

@susnux susnux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see comment

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 team: Files Code maintained by 📁 Files team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants