Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#66964] Custom PDF fonts: Already uploaded font is checked again and reported as invalid

as-op9a4ce48d6865
diff --git a/app/helpers/custom_styles_controller_helper.rb b/app/helpers/custom_styles_controller_helper.rb
index 8c1ca639e97..484e40aee17 100644
--- a/app/helpers/custom_styles_controller_helper.rb
+++ b/app/helpers/custom_styles_controller_helper.rb
@@ -33,7 +33,7 @@ module CustomStylesControllerHelper
def validate_font_uploads(custom_style_params)
%i(export_font_regular export_font_bold export_font_italic export_font_bold_italic).each do |name|
- if custom_style_params[name]&.is_a?(ActionDispatch::Http::UploadedFile)
+ if custom_style_params[name].is_a?(ActionDispatch::Http::UploadedFile)
error = validate_font_file(name, custom_style_params[name].tempfile)
return error if error
end
@@ -50,7 +50,7 @@ module CustomStylesControllerHelper
end
def validate_font_file_format(name, filename)
- "#{name.to_s.humanize} #{I18n.t("admin.custom_styles.fonts.file_is_invalid")}" unless valid_ttf?(filename)
+ "#{name.to_s.humanize} #{I18n.t('admin.custom_styles.fonts.file_is_invalid')}" unless valid_ttf?(filename)
end
def font_file_size(filename)
@@ -60,7 +60,8 @@ module CustomStylesControllerHelper
def validate_font_file_size(name, filename)
size = font_file_size(filename)
if size >= MAX_FONT_UPLOAD_SIZE
- "#{name.to_s.humanize} #{I18n.t("admin.custom_styles.fonts.file_too_large", count: (MAX_FONT_UPLOAD_SIZE / 1.megabyte).to_i)}"
+ "#{name.to_s.humanize} #{I18n.t('admin.custom_styles.fonts.file_too_large',
+ count: (MAX_FONT_UPLOAD_SIZE / 1.megabyte).to_i)}"
end
end