View Issue Details

IDProjectCategoryView StatusLast Update
0005220mantisbtbugtrackerpublic2009-06-26 11:59
Reporteriamcal Assigned Tograngeway  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionunable to reproduce 
Product Version0.19.2 
Summary0005220: url parser makes a few mistakes
Description

it doesn't allow [?=&] in urls, making urls with querystrings break

it doesn't allow capital letters in urls

it gets confused when urls have '@' symbols in them, after the first slash

the attched patch fixes these issues

TagsNo tags attached.
Attached Files
core__string_api.php.diff (963 bytes)   
--- core/string_api.php.orig	2005-02-07 12:23:52.725125000 -0800
+++ core/string_api.php	2005-02-07 12:22:54.287625000 -0800
@@ -292,7 +292,7 @@
 			return $p_string;
 		}
 		# Find any URL in a string and replace it by a clickable link		
-		$p_string = preg_replace( '/([http|irc|ftp|https]{2,}:\/\/([a-z0-9_-]|\/|\@|:{0,1}\.{0,1}){1,})/',
+		$p_string = preg_replace( '/([http|irc|ftp|https]{2,}:\/\/([a-zA-Z0-9_-]|\/|\@|[?=&]|:{0,1}\.{0,1}){1,})/',
 									'<a href="\1">\1</a> [<a href="\1" target="blank">^</a>]',   
 									$p_string);
 
@@ -304,7 +304,7 @@
 		#  when applied to data that has already had entities inserted.
 		#
 		# bpfennig: '@' doesn't accepted anymore
-		$t_atom = '[^\'@\'](?:[^()<>@,;:\\\".\[\]\000-\037\177 &]+)';
+		$t_atom = '[^\'@\'](?:[^()<>@,;:\/\\\".\[\]\000-\037\177 &]+)';
 
 		# In order to avoid selecting URLs containing @ characters as email
 		#  addresses we limit our selection to addresses that are preceded by:
core__string_api.php.diff (963 bytes)   

Relationships

parent of 0004439 closedgrangeway Mailto links include an unneccessary 'target="_new"' 
has duplicate 0006583 closedryandesign URL handling is broken. 
has duplicate 0006576 closedryandesign Upper case (Capitol) letters break HTML Links 
has duplicate 0006375 closedvboctor Posting web links 
child of 0005460 closedvboctor Critical Issues to Fix for Mantis 1.0.0 Release 

Activities

grangeway

grangeway

2005-02-08 18:28

reporter   ~0009260

This issue has already been fixed I believe - can you try http://cvs.sourceforge.net/viewcvs.py/*checkout*/mantisbt/mantisbt/core/string_api.php?rev=1.64

Feel free to reopen if not.

Paul

grangeway

grangeway

2005-02-08 18:31

reporter   ~0009262

@@ -304,7 +304,7 @@

when applied to data that has already had entities inserted.

    #
    # bpfennig: '@' doesn't accepted anymore
  • $t_atom = '[^\'@\'](?:[^()<>@,;:\\".[]\000-\037\177 &]+)';
  • $t_atom = '[^\'@\'](?:[^()<>@,;:\/\\".[]\000-\037\177 &]+)';

And actually, this might still need doing.

jelv

jelv

2005-04-15 11:26

reporter   ~0009820

I lifted the latest version of the change from the CVS and patched it in to 19.2 - it fixed a problem I had with a URL with ? and &.

However still had a problem with a URL of http://usertools.plus.net/@gateway which gets changed to a mailto

The change in note 9262 is not in CVS - when I applied that it fixed the problem.

jelv

jelv

2005-05-10 06:32

reporter   ~0010058

I think there may still be a problem with email addresses. I have colon space preceeding the email address for example: abc@domainname.com.

The href produced has the leading space included as part of the mailto e.g. mailto:%20abc@...

If I am right it will happen in this note.

jelv

jelv

2005-05-10 06:35

reporter   ~0010059

I was right you can see the problem in the last note.

But there appears to be another problem as well - where did the "/>" come from?

stefanb

stefanb

2005-05-25 09:06

reporter   ~0010222

The "/>" is the rest of a line break tag. If you hover your mouse over the Link in 0005220:0010058, so can see the following link target in your status bar:


mailto: abc@domainname.com.<br

jelv

jelv

2005-06-07 09:00

reporter   ~0010386

This bug ought to have a relationship with 0004439 added.

grangeway

grangeway

2009-05-23 09:47

reporter   ~0021883

The url parsing functionality has been rewritten since 2005/6 ;/

Paul