Defect #27968

Image filename for HDPI monitors (image@2x.jpg) are misrecognized as email address

Added by Go MAEDA 4 months ago. Updated 13 days ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Text formatting
Target version:4.0.0
Resolution: Affected version:

Description

Image files for HDMI monitors (e.g., MacBook Pro Retina monitors) usually have "@2x" suffix in their filename, like "". If you write such filenames in issues or wiki pages, Redmine misrecognizes them as email addresses and they will have useless "mailto:" link.

Example:

logo@2x.png

is rendered as

"<a href="mailto:logo@2x.png">logo@2x.png</a>" 

0001-do-not-recognize-hires-images-as-email-addresses.patch Magnifier (3.18 KB) Marius BALTEANU, 2018-04-29 09:01


Related issues

Related to Redmine - Defect #26507: "attachment:filename" link syntax would not work if the f... Confirmed

History

#1 Updated by Mischa The Evil 4 months ago

  • Related to Defect #26507: "attachment:filename" link syntax would not work if the file name contains "@" added

#2 Updated by Marius BALTEANU about 1 month ago

Go Maeda, what do you think about restoring only the following patterns: (.*@2x\.(png|jpg|gif|jpeg))?

In this way, formats like:
- : it'll be restored to string
- : it'll link to mailto:
- : it'll be restored to string
- : it'll be restored to string

#3 Updated by Go MAEDA about 1 month ago

Marius BALTEANU wrote:

Go Maeda, what do you think about restoring only the following patterns: (.*@2x\.(png|jpg|gif|jpeg))?

I think more image extensions such as "bmp" and "jpe" should be supported. Please see source:tags/3.4.5/app/helpers/application_helper.rb#L713

  def parse_hires_images(text, project, obj, attr, only_path, options)
    text.gsub!(/src="([^"]+@(\dx)\.(bmp|gif|jpg|jpe|jpeg|png))"/i) do |m|
      filename, dpr = $1, $2
      m + " srcset=\"#{filename} #{dpr}\"" 
    end
  end

#4 Updated by Marius BALTEANU about 1 month ago

Go MAEDA wrote:

I think more image extensions such as "bmp" and "jpe" should be supported. Please see source:tags/3.4.5/app/helpers/application_helper.rb#L713

[...]

Perfect, thanks for pointing me to that line, I didn't know about it.

#5 Updated by Marius BALTEANU 26 days ago

Attached a patch that fixes this issue. It should be applied after the fix from #26507.

#6 Updated by Go MAEDA 13 days ago

  • Target version set to 4.0.0

Also available in: Atom PDF