nextcloud / nextcloud/text

Attachment filenames from macOS fail due to missing NFC normalization in Text app

Open Beginner friendly
#7,873 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature: attachments
Dominant language
JavaScript
Stars
659
Forks
133
Avg merge
1d 20h
Merged PRs (30d)
110

Description

Short summary of the issue

When attaching files from macOS in the Nextcloud Text app, filenames containing special characters are not properly linked. This happens because macOS uses NFD for filenames by default, but the Text app does not normalize them to NFC during upload. The issue occurs in Chrome and Firefox, while Safari works correctly because it automatically converts filenames to NFC on upload.

When attempting to attach files from macOS in the Nextcloud Text app, the files cannot be correctly linked. This is caused by a mismatch in Unicode normalization forms: macOS uses NFD for filenames by default, while the app expects NFC. Currently, the Text app does not normalize filenames during upload, which leads to issues when referencing these files.

  • Markdown syntax is not properly rendered in text
  • Markdown syntax is removed after closing text
  • Markdown syntax is changed after closing text
  • Something else: File attachments from macOS fail to link due to missing NFC normalization

Example markdown file

Uploaded form Windows Machine / converted with Normalizer
![Bro schüre.docx](.attachments.9168420/Bro%20sch%C3%BCre.docx)

Uploaded directly from Mac without Normalization
![Bro schüre (3).docx](.attachments.9168420/Bro%20schu%CC%88re%20%283%29.docx)

Screenshot of the rendering in text

Image

Details

  • Nextcloud version: 31.0.10 Community

Workaround / Suggested fix:

Inside the file /pathToNextcloud/apps/text/lib/Controller/AttachmentController.php, in the function uploadAttachment(string $token), change:

$newFileName = $file['name'];

to

$newFileName = normalizer_normalize($file['name'], Normalizer::FORM_C);

This normalizes the filename to NFC on upload, allowing proper linking of macOS files in all browsers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in apps/text/lib/Controller/AttachmentController.php, specifically uploadAttachment(string $token), and inspect how the uploaded filename is stored and later referenced. Reproduce the macOS NFD filename case from the issue and verify that the attachment links correctly after NFC normalization in Chrome and Firefox.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.