Fix file icon rendering for all-caps file extesions [SCI-10638]

This commit is contained in:
Martin Artnik 2024-04-15 12:12:13 +02:00
parent 3882f5e33e
commit 96ebe450c9

View file

@ -62,7 +62,7 @@ module FileIconsHelper
# For showing in view/edit icon url (WOPI) # For showing in view/edit icon url (WOPI)
def file_application_url(asset) def file_application_url(asset)
file_ext = asset.file_name.split('.').last file_ext = asset.file_name.split('.').last&.downcase
if Constants::FILE_TEXT_FORMATS.include?(file_ext) if Constants::FILE_TEXT_FORMATS.include?(file_ext)
'icon_small/docx_file.svg' 'icon_small/docx_file.svg'
elsif Constants::FILE_TABLE_FORMATS.include?(file_ext) elsif Constants::FILE_TABLE_FORMATS.include?(file_ext)
@ -73,7 +73,7 @@ module FileIconsHelper
end end
def sn_icon_for(asset) def sn_icon_for(asset)
file_ext = asset.file_name.split('.').last file_ext = asset.file_name.split('.').last&.downcase
if Constants::FILE_TEXT_FORMATS.include?(file_ext) if Constants::FILE_TEXT_FORMATS.include?(file_ext)
'file-word' 'file-word'
elsif Constants::FILE_TABLE_FORMATS.include?(file_ext) elsif Constants::FILE_TABLE_FORMATS.include?(file_ext)
@ -95,7 +95,7 @@ module FileIconsHelper
# Shows correct WOPI application text (Word Online/Excel ..) # Shows correct WOPI application text (Word Online/Excel ..)
def wopi_button_text(asset, action) def wopi_button_text(asset, action)
file_ext = asset.file_name.split('.').last file_ext = asset.file_name.split('.').last&.downcase
if Constants::FILE_TEXT_FORMATS.include?(file_ext) if Constants::FILE_TEXT_FORMATS.include?(file_ext)
app = I18n.t('result_assets.wopi_word') app = I18n.t('result_assets.wopi_word')
elsif Constants::FILE_TABLE_FORMATS.include?(file_ext) elsif Constants::FILE_TABLE_FORMATS.include?(file_ext)