Skip to content

fix(FilePreview): sanitize file name - #19228

Merged
Antreesy merged 4 commits into
mainfrom
fix/1963/sanitize-file-name
Sep 2, 2026
Merged

fix(FilePreview): sanitize file name#19228
Antreesy merged 4 commits into
mainfrom
fix/1963/sanitize-file-name

Conversation

@Antreesy

@Antreesy Antreesy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

☑️ Resolves

  • Refactor + Hardening for FilePreview
    • drop redundant prop smallPreview - always used in pair with rowLayout
    • sanitize filename on rendering - keep file extension a static append to the file name (aligned with Files app)
    • highlight extension

AI (if applicable)

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

🖌️ UI Checklist

🖼️ Screenshots / Screencasts

🏚️ Before 🏡 After
image image
image image
image image
b image
bb image

🚧 Tasks

  • ...

🏁 Checklist

  • 🌏 Tested with different browsers / clients:
    • Chromium (Chrome / Edge / Opera / Brave)
    • Firefox
    • Safari
    • Talk Desktop
    • Integrations with Files sidebar and other apps
    • Not risky to browser differences / client
  • 🖌️ Design was reviewed, approved or inspired by the design team
  • ⛑️ Tests are included or not possible
  • 📗 User documentation in https://github.com/nextcloud/documentation/tree/master/user_manual/talk has been updated or is not required

- only used in SharedItems.vue together with rowLayout, so redundant

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
- bidi-control unicode characters are not visible in browser, but causing confusion with inline rendering under certain conditions
- for rendered DOM: align with Files app, render file extension in separate tag, isolate unicode-bidi
- for titles and aria-labels: replace with underscore (same as downloaded file name)

Assisted-by: ClaudeCode:claude-sonnet-5
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
@Antreesy Antreesy added this to the ☃️ Next Major (36) milestone Sep 2, 2026
@Antreesy Antreesy self-assigned this Sep 2, 2026
@Antreesy Antreesy added bug feature: frontend 🖌️ "Web UI" client feature: upload & shares & voice 📤🎙️ Sharing files into a chat and audio recordings labels Sep 2, 2026
@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Sep 2, 2026
@Antreesy

Antreesy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable35

@Antreesy

Antreesy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable34

@Antreesy

Antreesy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable33

@Antreesy

Antreesy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable32

@nickvergessen

nickvergessen commented Sep 2, 2026

Copy link
Copy Markdown
Member

Small improvement copied from files app for long names and color different on the extension:
grafik

Details
diff --git a/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue b/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue
index 3dcf2ab66e..e23f8e29fe 100644
--- a/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue
+++ b/src/components/MessagesList/MessagesGroup/Message/MessagePart/FilePreview.vue
@@ -95,7 +95,7 @@
                        </template>
                </NcButton>
                <div v-if="shouldShowFileDetail" class="name-container">
-                       <span class="name-container__basename">{{ fileNameWithoutExtension }}</span><span v-if="fileExtension">{{ fileExtension }}</span>
+                       <span class="name-container__basename">{{ fileNameWithoutExtension }}</span><span v-if="fileExtension" class="name-container__extension">{{ fileExtension }}</span>
                </div>
        </component>
 </template>
@@ -796,10 +796,18 @@ export default {
                width: 100%;
                overflow: hidden;
                white-space: nowrap;
-               text-overflow: ellipsis;
+               display: inline-flex;
 
                &__basename {
                        unicode-bidi: isolate;
+                       overflow: hidden;
+                       white-space: nowrap;
+                       text-overflow: ellipsis;
+               }
+
+               &__extension {
+                       color: var(--color-text-maxcontrast);
+                       overflow: visible;
                }
        }
 

Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
@Antreesy
Antreesy merged commit 1c6d1c7 into main Sep 2, 2026
53 of 55 checks passed
@Antreesy
Antreesy deleted the fix/1963/sanitize-file-name branch September 2, 2026 11:51
@backportbot

This comment was marked as off-topic.

@backportbot

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits backport-request bug feature: frontend 🖌️ "Web UI" client feature: upload & shares & voice 📤🎙️ Sharing files into a chat and audio recordings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants