aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/View/Web.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
index 28c159cf2..8d3775ddc 100644
--- a/perllib/FixMyStreet/App/View/Web.pm
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -121,11 +121,16 @@ sub add_links {
$text =~ s/\r//g;
$text = ent($text);
- $text =~ s{(https?://[^\s]+)}{<a href="$1">$1</a>}g;
- #$text =~ s{">(.*?)<}{">$1<}ge;
+ $text =~ s{(https?://)([^\s]+)}{"<a href='$1$2'>$1" . _space_slash($2) . '</a>'}ge;
return $text;
}
+sub _space_slash {
+ my $t = shift;
+ $t =~ s{/(?!$)}{/ }g;
+ return $t;
+}
+
=head2 escape_js
Used to escape strings that are going to be put inside JavaScript.