URI validation and cleanup

AaronUnwired - April 27, 2009 - 06:33
Project:CCK Redirection
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

A node with a "cck redirect field" in use redirects a URI as expected. However when the information text "This node is redirected to a remote URI." is displayed the link (which encompasses the section of text "remote URI") unexpectedly points http:// instead of the expected /foo/bar

e.g. If "/foo/bar" is the set value for a cck redirect field, the href value for the text "remote URI" will have "http://" pre-appended. The resulting href value would end up being "http://foo/bar/".

Of note regarding the above example; there are are only two forward slashes and not three as would be expected if "/foo/bar" was concatenated to "http://" (e.g. http:///foo/bar). As it stands it appears the leading slash is removed from the URI.

Reproduction steps:

  • Modify content type "Page"
  • Add a new cck field for cck redirect
  • Edit or create page node and enter a URI (e.g. without http://)
  • Save the page, the resulting page will display the text "This node is redirected to a remote URI."
  • Click the link "remote URI"

#1

guix - June 24, 2009 - 21:35
Title:Text "This node is redirected to a remote URI." link is invalid if a URI is used» No link validation
Component:User interface» Code
Priority:minor» normal

Hello, this is because there's no link validation yet, maybe we could add this after #501024: Code in CVS is saved with the wrong line ending format. I have the code ready, "stolen" straight away from CCK Link...

#2

guix - June 26, 2009 - 04:47
Title:No link validation» URI validation and cleanup
Version:6.x-1.1» 6.x-1.2
Status:active» needs review

Here is an URI validation (protocols allowed : http, https) and cleanup (trims spaces, adds http:// if no protocol specified). The code is taken from CCK Link (why re-invent the wheel) and slightly adapted.

There seems to be still a problem with the lines numerotation (see #501024: Code in CVS is saved with the wrong line ending format), leading to big patches that remove a lot of code and adds it back...

AttachmentSize
cck_redirection-445894-2.patch 40.65 KB

#3

guix - June 26, 2009 - 05:21
Status:needs review» needs work

OK, sorry, realized I coded from 6.x-1.2 where there are still the line ends problems. Re-rolling against CVS HEAD.

#4

guix - June 26, 2009 - 05:28
Status:needs work» needs review

Finally !

AttachmentSize
cck_redirection-445894-4.patch 4.71 KB

#5

guix - June 30, 2009 - 06:47

Hello ?

 
 

Drupal is a registered trademark of Dries Buytaert.