summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-19 21:42:05 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-19 21:42:05 +0200
commit318c0ec9793beba1a6ac0e18168c774fce15dd37 (patch)
treedcbec10802cf60759eac9647dc57c56a0c9c00c7 /app
parent077916cf68d49bc4b9b184fb77a3965b80f3958a (diff)
Simplify sanitize_filenames for the unicode age
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/file_attachment.rb3
1 files changed, 2 insertions, 1 deletions
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
106 end 106 end
107 107
108 def sanitize_filename(filename) 108 def sanitize_filename(filename)
109 File.basename(filename).gsub(/[^\w\.\-]/, '_') 109 name = File.basename(filename).unicode_normalize(:nfc)
110 name.gsub(/(?u)[^\w\.\-]/, '_')
110 end 111 end
111 112
112 # Proxy object returned by asset.upload, providing the Paperclip-compatible 113 # Proxy object returned by asset.upload, providing the Paperclip-compatible