Skip to content

fix(files): normalize Unicode in node paths - #65514

Merged
icewind1991 merged 1 commit into
masterfrom
fix/normalize_nfd_filenames
Oct 15, 2026
Merged

icewind1991 merged 1 commit into
masterfrom
fix/normalize_nfd_filenames

Conversation

@mejo-

@mejo- mejo- commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Filesystem::normalizePath() converts paths to Unicode NFC, so the filecache and storage always use NFC names. The Node API uses PathHelper::normalizePath() instead, which didn't normalize Unicode. Nodes returned by Folder::newFile(), Folder::newFolder(), Node::copy() and Node::move() therefore kept the name exactly as passed in.

Files uploaded from macOS in Chrome or Firefox have NFD names. Apps that return $node->getName() after creating such a file sent back an NFD name for a file that is stored as NFC. Other clients then couldn't match the name against file listings, which broke attachments in Collectives and Text.

Normalize to NFC in PathHelper::normalizePath(), like Filesystem::normalizePath() does. Hooks and events emitted by the Node API now get NFC paths as well.

Refs: nextcloud/collectives#2327
Refs: nextcloud/text#7873

Assisted-by: ClaudeCode:claude-opus-5-5

Checklist

AI (if applicable)

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

@mejo- mejo- added this to the Nextcloud 36 milestone Oct 15, 2026
@mejo- mejo- self-assigned this Oct 15, 2026
@mejo- mejo- added the bug label Oct 15, 2026
@mejo-
mejo- requested a review from a team as a code owner October 15, 2026 06:00
@mejo- mejo- added 3. to review Waiting for reviews feature: files labels Oct 15, 2026
@mejo-
mejo- requested review from icewind1991, provokateurin, salmart-dev and sorbaugh and removed request for a team October 15, 2026 06:00
@github-project-automation github-project-automation Bot moved this to 🧭 Planning evaluation (don't pick) in 📝 Productivity team Oct 15, 2026
@mejo- mejo- moved this from 🧭 Planning evaluation (don't pick) to 👀 In review in 📝 Productivity team Oct 15, 2026
@mejo-

mejo- commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

/backport to stable35

@mejo-

mejo- commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

/backport to stable34

@mejo-

mejo- commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

/backport to stable33

mejo- added a commit to nextcloud/text that referenced this pull request Oct 15, 2026
Files uploaded from macOS in Chrome or Firefox have NFD names, while the
filecache, and therefore the attachment list, stores names in NFC. The
upload response returned the raw NFD name, so the editor inserted an NFD
`src`. AttachmentResolver compared names exactly, found no matching
attachment and fell back to loading the file as an image, which failed.

Normalize uploaded names to NFC before saving them, and compare names
in NFC in AttachmentResolver so that documents that already contain NFD
srcs resolve as well.

Fixes: #7873
Refs: nextcloud/server#65514
Refs: nextcloud/collectives#2327

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
Comment thread lib/private/Files/Utils/PathHelper.php Outdated
Filesystem::normalizePath() converts paths to Unicode NFC, so the
filecache and storage always use NFC names. The Node API uses
PathHelper::normalizePath() instead, which didn't normalize Unicode.
Nodes returned by Folder::newFile(), Folder::newFolder(), Node::copy()
and Node::move() therefore kept the name exactly as passed in.

Files uploaded from macOS in Chrome or Firefox have NFD names. Apps that
return $node->getName() after creating such a file sent back an NFD name
for a file that is stored as NFC. Other clients then couldn't match the
name against file listings, which broke attachments in Collectives and
Text.

Normalize to NFC in PathHelper::normalizePath(), like
Filesystem::normalizePath() does. Hooks and events emitted by the Node
API now get NFC paths as well.

Refs: nextcloud/collectives#2327
Refs: nextcloud/text#7873

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
@mejo-
mejo- force-pushed the fix/normalize_nfd_filenames branch from d3d1a75 to ed8bfe9 Compare October 15, 2026 09:34
@mejo-
mejo- requested a review from come-nc October 15, 2026 09:34
mejo- added a commit to nextcloud/text that referenced this pull request Oct 15, 2026
Files uploaded from macOS in Chrome or Firefox have NFD names, while the
filecache, and therefore the attachment list, stores names in NFC. The
upload response returned the raw NFD name, so the editor inserted an NFD
`src`. AttachmentResolver compared names exactly, found no matching
attachment and fell back to loading the file as an image, which failed.

Normalize uploaded names to NFC before saving them, and compare names
in NFC in AttachmentResolver so that documents that already contain NFD
srcs resolve as well.

Fixes: #7873
Refs: nextcloud/server#65514
Refs: nextcloud/collectives#2327

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
mejo- added a commit to nextcloud/text that referenced this pull request Oct 15, 2026
Files uploaded from macOS in Chrome or Firefox have NFD names, while the
filecache, and therefore the attachment list, stores names in NFC. The
upload response returned the raw NFD name, so the editor inserted an NFD
`src`. AttachmentResolver compared names exactly, found no matching
attachment and fell back to loading the file as an image, which failed.

Normalize uploaded names to NFC before saving them, and compare names
in NFC in AttachmentResolver so that documents that already contain NFD
srcs resolve as well.

Fixes: #7873
Refs: nextcloud/server#65514
Refs: nextcloud/collectives#2327

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
@icewind1991
icewind1991 merged commit 9366ee7 into master Oct 15, 2026
252 of 261 checks passed
@icewind1991
icewind1991 deleted the fix/normalize_nfd_filenames branch October 15, 2026 16:39
@github-project-automation github-project-automation Bot moved this from 👀 In review to ☑️ Done in 📝 Productivity team Oct 15, 2026
mejo- added a commit to nextcloud/text that referenced this pull request Oct 15, 2026
Files uploaded from macOS in Chrome or Firefox have NFD names, while the
filecache, and therefore the attachment list, stores names in NFC. The
upload response returned the raw NFD name, so the editor inserted an NFD
`src`. AttachmentResolver compared names exactly, found no matching
attachment and fell back to loading the file as an image, which failed.

Normalize uploaded names to NFC before saving them, and compare names
in NFC in AttachmentResolver so that documents that already contain NFD
srcs resolve as well.

Fixes: #7873
Refs: nextcloud/server#65514
Refs: nextcloud/collectives#2327

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
mejo- added a commit to nextcloud/text that referenced this pull request Oct 15, 2026
Files uploaded from macOS in Chrome or Firefox have NFD names, while the
filecache, and therefore the attachment list, stores names in NFC. The
upload response returned the raw NFD name, so the editor inserted an NFD
`src`. AttachmentResolver compared names exactly, found no matching
attachment and fell back to loading the file as an image, which failed.

Normalize uploaded names to NFC before saving them, and compare names
in NFC in AttachmentResolver so that documents that already contain NFD
srcs resolve as well.

Fixes: #7873
Refs: nextcloud/server#65514
Refs: nextcloud/collectives#2327

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ☑️ Done

Development

Successfully merging this pull request may close these issues.

5 participants