Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
f409dc58
Commit
f409dc58
authored
Apr 18, 2014
by
David Lawrence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 998323 - URLs pasted in comments are no longer displayed
r=LpSolit,a=justdave
parent
406dcbbc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
Template.pm
Bugzilla/Template.pm
+11
-14
No files found.
Bugzilla/Template.pm
View file @
f409dc58
...
...
@@ -152,13 +152,11 @@ sub quoteUrls {
# (http://foo/bug#3 for example). Filtering that out filters valid
# bug refs out, so we have to do replacements.
# mailto can't contain space or #, so we don't have to bother for that
# Do this by escaping \0 to \1\0, and replacing matches with \0\0$count\0\0
# \0 is used because it's unlikely to occur in the text, so the cost of
# doing this should be very small
# escape the 2nd escape char we're using
my
$chr1
=
chr
(
1
);
$text
=~
s/\0/$chr1\0/g
;
# Do this by replacing matches with \x{FDD2}$count\x{FDD3}
# \x{FDDx} is used because it's unlikely to occur in the text
# and are reserved unicode characters. We disable warnings for now
# until we require Perl 5.13.9 or newer.
no
warnings
'utf8'
;
# If the comment is already wrapped, we should ignore newlines when
# looking for matching regexps. Else we should take them into account.
...
...
@@ -189,11 +187,11 @@ sub quoteUrls {
$1, $2, $3, $4,
$5, $6, $7, $8,
$9, $10]}))
&& ("\
0\0" . ($count-1) . "\0\0
")/egx
;
&& ("\
x{FDD2}" . ($count-1) . "\x{FDD3}
")/egx
;
}
else
{
$text
=~
s/$match/($things[$count++] = $replace)
&& ("\
0\0" . ($count-1) . "\0\0
")/egx
;
&& ("\
x{FDD2}" . ($count-1) . "\x{FDD3}
")/egx
;
}
}
...
...
@@ -203,7 +201,7 @@ sub quoteUrls {
Bugzilla
->
params
->
{
'sslbase'
}))
.
')'
;
$text
=~
s
~\
b
(
$
{
urlbase_re
}
\
Qshow_bug
.
cgi
?
id
=\
E
([
0
-
9
]
+
)(
\
#c([0-9]+))?)\b
~
(
$things
[
$count
++
]
=
get_bug_link
(
$3
,
$1
,
{
comment_num
=>
$5
,
user
=>
$user
}))
&&
(
"\
0\0"
.
(
$count
-
1
)
.
"\0\0
"
)
(
"\
x{FDD2}"
.
(
$count
-
1
)
.
"\x{FDD3}
"
)
~
egox
;
# non-mailto protocols
...
...
@@ -211,7 +209,7 @@ sub quoteUrls {
$text
=~
s
~\
b
(
$safe_protocols
)
~
(
$tmp
=
html_quote
(
$1
))
&&
(
$things
[
$count
++
]
=
"<a href=\"$tmp\">$tmp</a>"
)
&&
(
"\
0\0"
.
(
$count
-
1
)
.
"\0\0
"
)
(
"\
x{FDD2}"
.
(
$count
-
1
)
.
"\x{FDD3}
"
)
~
egox
;
# We have to quote now, otherwise the html itself is escaped
...
...
@@ -232,7 +230,7 @@ sub quoteUrls {
# attachment links
$text =~ s~\b(attachment$s*\#?$s*(\d+)(?:$s+\[details\])?)
~($things[$count++] = get_attachment_link($2, $1, $user)) &&
("
\
0
\
0
" . ($count-1) . "
\
0
\
0
")
("
\
x
{
FDD2
}
" . ($count-1) . "
\
x
{
FDD3
}
")
~egmxi;
# Current bug ID this comment belongs to
...
...
@@ -293,9 +291,8 @@ sub quoteUrls {
# Now remove the encoding hacks in reverse order
for
(
my
$i
=
$#things
;
$i
>=
0
;
$i
--
)
{
$text
=~
s/\
0\0($i)\0\0
/$things[$i]/eg
;
$text
=~
s/\
x{FDD2}($i)\x{FDD3}
/$things[$i]/eg
;
}
$text
=~
s/$chr1\0/\0/g
;
return
$text
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment