Skip to content

email preview error when image attachment filename doesn't include extension #118

@batrachian

Description

@batrachian

Attempt to preview a MIME email with in-line image, the MIME info for the image filename doesn't include a filename extension:

No route matches {:action=>"more_asset", :asset=>"m_5593444617102028495_com_samsung_android_email_attachmentprovider_1_37047_RAW_1756857510038", :assetformat=>nil, :controller=>"attachments", :id=>#}, possible unmatched constraints: [:assetformat]
/usr/local/lib/ruby/gems/3.3/gems/actionpack-7.2.2.1/lib/action_dispatch/journey/formatter.rb:46:in `path'
/usr/local/lib/ruby/gems/3.3/gems/actionpack-7.2.2.1/lib/action_dispatch/routing/route_set.rb:868:in `url_for'
/usr/local/lib/ruby/gems/3.3/gems/actionpack-7.2.2.1/lib/action_dispatch/routing/route_set.rb:289:in `call'
/usr/local/lib/ruby/gems/3.3/gems/actionpack-7.2.2.1/lib/action_dispatch/routing/route_set.rb:345:in `block in define_url_helper'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/patches/attachment_patch.rb:97:in `asset_link'
/usr/local/lib/ruby/gems/3.3/gems/activesupport-7.2.2.1/lib/active_support/core_ext/object/try.rb:15:in `public_send'
/usr/local/lib/ruby/gems/3.3/gems/activesupport-7.2.2.1/lib/active_support/core_ext/object/try.rb:15:in `try'
(erb):5:in `block in list'
(erb):2:in `each'
(erb):2:in `list'
/usr/local/lib/ruby/gems/3.3/gems/erb-5.0.1/lib/erb.rb:427:in `eval'
/usr/local/lib/ruby/gems/3.3/gems/erb-5.0.1/lib/erb.rb:427:in `result'
/usr/local/www/redmine/plugins/redmine_more_previews/converters/cliff/lib/cliff.rb:378:in `list'
/usr/local/www/redmine/plugins/redmine_more_previews/converters/cliff/lib/cliff.rb:93:in `eml'
/usr/local/www/redmine/plugins/redmine_more_previews/converters/cliff/lib/cliff.rb:46:in `convert'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/conversion.rb:193:in `block in transient_preview'
/usr/local/lib/ruby/3.3/tmpdir.rb:99:in `mktmpdir'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/conversion.rb:186:in `transient_preview'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/conversion.rb:169:in `block in preview'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/conversion.rb:137:in `synchronize'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/conversion.rb:137:in `sync'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/conversion.rb:169:in `preview'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/converter.rb:265:in `convert'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/patches/attachment_patch.rb:37:in `more_preview'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/patches/attachments_controller_patch.rb:99:in `send_more_preview'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/patches/attachments_controller_patch.rb:61:in `block (2 levels) in more_preview'
/usr/local/lib/ruby/gems/3.3/gems/actionpack-7.2.2.1/lib/action_controller/metal/mime_responds.rb:224:in `respond_to'
/usr/local/www/redmine/plugins/redmine_more_previews/lib/redmine_more_previews/patches/attachments_controller_patch.rb:60:in `more_preview'

Trial-and-error determined that adding a file extension (.png) to the filename in the Content-Disposition line in the MIME header for the image resulted in success:

Content-Type: image/png; 
        name=m_5593444617102028495_com_samsung_android_email_attachmentprovider_1_37047_RAW_1756857510038
Content-Disposition: inline; 
        filename=m_5593444617102028495_com_samsung_android_email_attachmentprovider_1_37047_RAW_1756857510038.png
Content-Transfer-Encoding: base64
Content-ID: <ii_199120b2f4e259d3d302>
X-Attachment-Id: ii_199120b2f4e259d3d302

Unfortunately my Ruby-Fu is not yet up to determining a possible solution for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions