Commit 21494e84 authored by jplang's avatar jplang

"attachment:filename" link syntax would not work if the file name contains "@" (#26507).

Patch by Marius BALTEANU.

git-svn-id: https://svn.redmine.org/redmine/trunk@17393 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 333a8e39
......@@ -180,6 +180,10 @@ module Redmine
html.gsub!(%r{\buser:<a(\sclass="email")? href="mailto:(.*?)">(.*?)<\/a>}) do
"user:#{$2}"
end
# restore attachments links with @ in file name eg. [attachment:image@2x.png]
html.gsub!(%r{\battachment:<a(\sclass="email")? href="mailto:(.*?)">(.*?)</a>}) do
"attachment:#{$2}"
end
html
end
end
......
......@@ -694,6 +694,22 @@ RAW
textilizable('attachment:test.txt', :attachments => [a1, a2])
end
def test_attachment_links_to_images_with_email_format_should_not_be_parsed
attachment = Attachment.generate!(:filename => 'image@2x.png')
with_settings :text_formatting => 'textile' do
raw = "attachment:image@2x.png should not be parsed in image@2x.png"
assert_match %r{<p><a class="attachment" href="/attachments/#{attachment.id}/image@2x.png">image@2x.png</a> should not be parsed in <a class="email" href="mailto:image@2x.png">image@2x.png</a></p>},
textilizable(raw, :attachments => [attachment])
end
with_settings :text_formatting => 'markdown' do
raw = "attachment:image@2x.png should not be parsed in image@2x.png"
assert_match %r{<p><a class="attachment" href="/attachments/#{attachment.id}/image@2x.png">image@2x.png</a> should not be parsed in <a href="mailto:image@2x.png">image@2x.png</a></p>} ,
textilizable(raw, :attachments => [attachment])
end
end
def test_wiki_links
User.current = User.find_by_login('jsmith')
russian_eacape = CGI.escape(@russian_test)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment