Relationship Graph
View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0007790 | mantisbt | bugtracker | public | 2007-03-01 00:34 | 2009-06-23 15:28 |
| Reporter | exk72 | Assigned To | jreese | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | PC | OS | Windows XP | OS Version | 5.1 |
| Product Version | git trunk | ||||
| Target Version | 1.2.0rc1 | Fixed in Version | 1.2.0rc1 | ||
| Summary | 0007790: Links protected by brackets are not processed properly | ||||
| Description | Same as the closed bug 0004326 | ||||
| Tags | url, usability | ||||
| Attached Files | 7790.patch (1,229 bytes)
Index: core/string_api.php
===================================================================
--- core/string_api.php (revision 5752)
+++ core/string_api.php (working copy)
@@ -411,13 +411,26 @@
# --------------------
# Detect href anchors in the string and replace them with URLs and email addresses
function string_strip_hrefs( $p_string ) {
-
# First grab mailto: hrefs. We don't care whether the URL is actually
# correct - just that it's inside an href attribute.
$p_string = preg_replace( '/<a\s[^\>]*href="mailto:([^\"]+)"[^\>]*>[^\<]*<\/a>/si', '\1', $p_string );
# Then grab any other href
$p_string = preg_replace( '/<a\s[^\>]*href="([^\"]+)"[^\>]*>[^\<]*<\/a>/si', '\1', $p_string );
+ //EC RH http://www.mantisbt.org/bugs/view.php?id=7790
+ if(strstr($p_string, '(')){
+ if(strstr($p_string, '(http://')) {
+ $start = strpos($p_string, '(http://'); $tmp = substr($p_string, $start, strlen($p_string));
+ $lnt = strpos($tmp, ' ');$stop = $start + $lnt;
+ $tmp = substr($p_string, $start, $lnt);
+ $h = strripos($tmp,'(');
+ if($h == 0){
+ $p_string = str_replace('(', '', $p_string);
+ $p_string = str_replace(')', '', $p_string);
+ }
+ }
+ }
+ //EC RH
return $p_string;
}
| ||||
|
Same with parens, e.g.: (http://www.mantisbt.org/bugs/view.php?id=4326) |
|
|
Targetting for 1.2.x - fix should be contained to string_api.php. |
|
|
The real trouble with this "bug" is that parenthesis and bracket characters are perfectly valid as part of well-formed URLs. However, it might be possible to add some sort of "simple" regex to pull out and discard pairs of parens or brackets from right around a URL... |
|
|
My suggestion is to include closing parenthesis in URL only if it has matching opening parenthesis, e.g. ")" linked: http://en.wikipedia.org/wiki/Mantis_(disambiguation) ")" not linked: http://en.wikipedia.org/wiki/Mantis_Bug_Tracker) |
|
|
Attached patch "7790.patch" strip off the parentheses in the case they are not part of the url. The fix doesn't affect links like http://en.wikipedia.org/wiki/Mantis_(disambiguation) . |
|
|
Fix committed to 1.2.x development tree. |
|
related to
child of
duplicate of