From 318c0ec9793beba1a6ac0e18168c774fce15dd37 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sun, 19 Jul 2026 21:42:05 +0200 Subject: Simplify sanitize_filenames for the unicode age --- app/models/concerns/file_attachment.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/file_attachment.rb b/app/models/concerns/file_attachment.rb index 613a6f0..3c09456 100644 --- a/app/models/concerns/file_attachment.rb +++ b/app/models/concerns/file_attachment.rb @@ -106,7 +106,8 @@ module FileAttachment end def sanitize_filename(filename) - File.basename(filename).gsub(/[^\w\.\-]/, '_') + name = File.basename(filename).unicode_normalize(:nfc) + name.gsub(/(?u)[^\w\.\-]/, '_') end # Proxy object returned by asset.upload, providing the Paperclip-compatible -- cgit v1.3