The comment in url_is_external() is wrong:
function url_is_external($path) {
$colonpos = strpos($path, ':');
// Only call the slow drupal_strip_dangerous_protocols() if $path contains a
// ':' before any / ? or #.
return $colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && drupal_strip_dangerous_protocols($path) == $path;
}
In fact, we only call drupal_strip_dangerous_protocols() if $path does not contain a / ? or # before the first ':'.
A good explanation is in drupal_strip_dangerous_protocols()
// If a colon is preceded by a slash, question mark or hash, it cannot
// possibly be part of the URL scheme. This must be a relative URL, which
// inherits the (safe) protocol of the base document.
Comment | File | Size | Author |
---|---|---|---|
#14 | 1113702-url_is_external_comment.patch | 754 bytes | franz |
#6 | 1113702-url_is_external_comment.patch | 755 bytes | franz |
#2 | 1113702-url_is_external_comment.patch | 756 bytes | franz |
Comments
Comment #1
bfroehle CreditAttribution: bfroehle commentedSetting the priority to minor, as it's just a bug in the comments.
Comment #2
franzI'm giving a shot at it.
Comment #3
christefano CreditAttribution: christefano commentedThis is ready to go. Thanks, franz!
This review was done at DrupalCamp LA 2011 during a live session. You're famous!
Comment #4
franzcool. =)
Comment #5
klausitrailing white space
20 days to next Drupal core point release.
Comment #6
franzComment #8
franz#6: 1113702-url_is_external_comment.patch queued for re-testing.
Comment #10
franz#6: 1113702-url_is_external_comment.patch queued for re-testing.
Comment #11
marcingy CreditAttribution: marcingy commentedWhite space issue has been fixed.
Comment #12
Dries CreditAttribution: Dries commentedShouldn't it be 'a URL' instead of 'an URL'?
Comment #13
franzIt seems to depend on how you pronnounce it: http://grammar.ccc.commnet.edu/grammar/abbreviations.htm (Using articles with abbreviations and acronyms) and http://grammar.ccc.commnet.edu/grammar/grammarlogs1/grammarlogs254.htm (Ctrl + F to searh for "an URL")
In my case I should've used "a URL" but I don't know about the standards adopted - if any - for this.
Comment #14
franzHowever, my sources could be outdated, I checked a free online dictionary and pronunciation is like "yoo-arr-ell" (and not something ugly as "earl") so it should be "a URL".
Comment #15
franzSimple change, doesn't need testing again.
Comment #16
catchCommitted to 8.x, back to 7.x for webchick.
Comment #17
webchickCommitted and pushed to 7.x. Thanks!