DEV: Refactor to add Custom emoji sanitization (#24368)

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
Juan David Martínez Cubillos
2024-05-27 08:24:55 -05:00
committed by GitHub
parent 51e02e0d31
commit 7992d7a65a
3 changed files with 6 additions and 3 deletions

View File

@@ -16,8 +16,7 @@ class Admin::EmojisController < Admin::AdminController
hijack do
# fix the name
name = File.basename(name, ".*")
name = name.gsub(/[^a-z0-9]+/i, "_").gsub(/_{2,}/, "_").downcase
name = Emoji.sanitize_emoji_name(name)
upload =
UploadCreator.new(file.tempfile, file.original_filename, type: "custom_emoji").create_for(
current_user.id,