Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory @ rb_sysopen in attachment_patch.rb:102:in `asset_link' #87

Open
jcatrysse opened this issue Aug 22, 2023 · 0 comments

Comments

@jcatrysse
Copy link

Hello Dr. Wenzel,

I've recently set up the Redmine More Previews plugin on a fresh Redmine 5 installation. However, I've encountered an issue when attempting to preview .eml files. An error is thrown, suggesting an issue with an unknown filename.

Upon investigation, I pinpointed the cause to the asset_link method, where Marcel::MimeType isn't receiving the complete pathname for the asset.

Below is a patch that resolved the issue on my end:

Index: lib/redmine_more_previews/patches/attachment_patch.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/redmine_more_previews/patches/attachment_patch.rb b/lib/redmine_more_previews/patches/attachment_patch.rb
--- a/lib/redmine_more_previews/patches/attachment_patch.rb	(revision f5e54c9c2fd469035f8262b9a9a3a8f1b93565dc)
+++ b/lib/redmine_more_previews/patches/attachment_patch.rb	(revision e2785c2668c41a73b62325945f89a2dfb79824ac)
@@ -97,9 +97,9 @@
             _link = Rails.application.routes.url_helpers.more_asset_path(
               self, basename, extname[1..-1]
             )
-            
+
             ApplicationController.helpers.link_to( asset, _link,
-             :class => "icon icon-file #{Marcel::MimeType.for(Pathname.new(asset), name: File.basename(asset))&.tr('/', '-')}",
+             :class => "icon icon-file #{Marcel::MimeType.for(Pathname.new(File.join(preview_storagepath, 'preview.html', asset)), name: File.basename(asset))&.tr('/', '-')}",
              :style => "padding-top:2px;padding-bottom:2px;"
             )
           end #def
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant