diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index c8559438..49d9d766 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -334,17 +334,13 @@ class DmsfFilesController < ApplicationController end def thumbnail - if @file.image? - tbnail = @file.thumbnail(size: params[:size]) - if tbnail - if stale?(etag: tbnail) - send_file tbnail, - filename: filename_for_content_disposition(@file.last_revision.disk_file), - type: @file.last_revision.detect_content_type, - disposition: 'inline' - end - else - head :not_found + tbnail = @file.thumbnail(size: params[:size]) + if tbnail + if stale?(etag: tbnail) + send_file tbnail, + filename: filename_for_content_disposition(@file.last_revision.disk_file), + type: @file.last_revision.detect_content_type, + disposition: 'inline' end else head :not_found diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 08f09370..70fe2eb4 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -499,7 +499,7 @@ class DmsfFile < ApplicationRecord end def thumbnailable? - image? && Redmine::Thumbnail.convert_available? + Redmine::Thumbnail.convert_available? && (image? || (pdf? && Redmine::Thumbnail.gs_available?)) end def previewable? @@ -592,8 +592,6 @@ class DmsfFile < ApplicationRecord end def thumbnail(options = {}) - return unless image? - size = options[:size].to_i if size.positive? # Limit the number of thumbnails per image @@ -606,7 +604,7 @@ class DmsfFile < ApplicationRecord size = 100 unless size.positive? target = File.join(Attachment.thumbnails_storage_path, "#{id}_#{last_revision.digest}_#{size}.thumb") begin - Redmine::Thumbnail.generate last_revision.disk_file.to_s, target, size + Redmine::Thumbnail.generate last_revision.disk_file.to_s, target, size, pdf? rescue StandardError => e Rails.logger.error do %(An error occured while generating thumbnail for #{last_revision.disk_file} to #{target}\n diff --git a/app/views/dmsf_files/_file_new_revision.html.erb b/app/views/dmsf_files/_file_new_revision.html.erb index 0c91e015..92b2f891 100644 --- a/app/views/dmsf_files/_file_new_revision.html.erb +++ b/app/views/dmsf_files/_file_new_revision.html.erb @@ -67,7 +67,7 @@ <%= label_tag 'file_upload', l(:label_new_content) %> <%= render partial: 'dmsf_upload/form', - locals: { multiple: false, container: nil, description: false, awf: false } %> + locals: { multiple: false, container: nil, awf: false } %>
diff --git a/app/views/dmsf_links/create.js.erb b/app/views/dmsf_links/create.js.erb
index 2ebe10ac..3007d210 100644
--- a/app/views/dmsf_links/create.js.erb
+++ b/app/views/dmsf_links/create.js.erb
@@ -27,7 +27,7 @@ var awf = false;
<% file = @dmsf_link.target_file %>
<% if file && !file.locked? && User.current.allowed_to?(:file_approval, file.project) %>
<% revision = file.last_revision %>
- <% if revision && revision.workflow.nil? %>
+ <% if revision&.workflow.nil? %>
awf = true;
<% end %>
<% end %>
diff --git a/app/views/dmsf_upload/_form.html.erb b/app/views/dmsf_upload/_form.html.erb
index 2610fbec..e4c214af 100644
--- a/app/views/dmsf_upload/_form.html.erb
+++ b/app/views/dmsf_upload/_form.html.erb
@@ -17,42 +17,53 @@
#