Defect #42

issue URL in repository comment break

Added by Peer Allan over 10 years ago. Updated over 10 years ago.

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

0%

Category:-
Target version:-
Resolution: Affected version:

Description

If we have a comment in subversion like this:

issue #245; fixed the problem

The URL for the link includes the semi-colon and the link text does not:

issue <a href="/issues/show/281;">#281</a>

Clicking on these links generates a 404 error.

Thanks!

History

#1 Updated by Jean-Philippe Lang over 10 years ago

Fix committed.
Instead of generating textile links, html links are directly
generated.
eg.
text = text.gsub(/#(\d+)(?=\b)/) {|m| link_to "##{$1}",
:controller => 'issues', :action => 'show', :id => $1}

#2 Updated by Pavol Murin over 10 years ago

Fix: it is necessary to add a space after the link, as the word
boundary might be a character. I fixed it in the following way:

change in app/helpers/application_helper.rb:

line 122:
text = text.gsub(/#(\d+)(?=\b)/) {|m|
"\"##{$1}\":" + url_for(:controller =>
'issues', :action => 'show', :id => $1) }

to:
text = text.gsub(/#(\d+)(?=\b)/) {|m|
"\"##{$1}\":" + url_for(:controller =>
'issues', :action => 'show', :id => $1) + " " }

and line 127:
text = text.gsub(/r(\d+)(?=\b)/) {|m|
"\"r#{$1}\":" + url_for(:controller =>
'repositories', :action => 'revision', :id => @project.id,
:rev => $1) } if @project

to:

text = text.gsub(/r(\d+)(?=\b)/) {|m|
"\"r#{$1}\":" + url_for(:controller =>
'repositories', :action => 'revision', :id => @project.id,
:rev => $1) + " " } if @project

muro

Also available in: Atom PDF