Closed (fixed)
Project:
Link
Version:
5.x-2.5
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
20 Oct 2008 at 20:47 UTC
Updated:
15 Mar 2010 at 02:10 UTC
Jump to comment: Most recent file
Hello,
I installed the Link module with the sole purpose of creating a Facebook profile link field for user's submitting their user profiles. However, when I add a facebook profile link (http://www.facebook.com/home.php#/profile.php?id=8644183&ref=profile) I receive an invalid URL error upon submission. It doesn't seem to like the second ".php" - if i delete that it seems to work. Anything I can do to work around this?
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | link_d6_optional_validation.patch | 1.57 KB | calebtr |
Comments
Comment #1
uw07 commentedNope, nevermind. It's the "#" symbol. Is there a way that I can allow this to ignore the "#"?
Comment #2
uw07 commentedComment #3
quicksketchHmm, this isn't a proper URL format, so link.module is correctly flagging it as incorrect. Facebook allows you to use simply http://www.facebook.com/profile.php?id=8644183, I'd suggest you use that instead.
Comment #4
uw07 commentedI'm just worried that people are going to copy and paste from their Facebook profile (which is how I got the link in the example).
It is the "#" that seems to be rejected. Isn't that a pretty common character in URLs?
Comment #5
quicksketchThe # symbol is used to reference a location in the middle of a webpage, rather than the top of the page like most links. The link you posted is invalid because a slash cannot be used after the # (inside what is called a "named anchor").
The most viable solution I can see here is providing a way to turn off validation entirely as the URL validation is already very loose.
Comment #6
uw07 commentedThank you again for the reply. Is there a way to turn off the URL validation? Or is this something that has do be changed within the module?
Comment #7
quicksketchRight now there isn't a way to turn off validation, it'll need to be added to the module as a feature. I'm not working extensively on the module but I'd be accepting of patches that are volunteered to fix the problem.
Comment #8
jaydub commentedrelated to #427990: Incorrect fragment handling
Comment #9
Toque commentedTiny url
Comment #10
pescetti commentedsubscribing
Comment #11
funana commentedHey, could you at least tell us which lines of the code we have to comment out to do this? This would solve all the problems with special characters, question marks etc. I guess...
Comment #12
calebtr commentedThe main reason you don't want to just comment out the validation code is that the validation function is used to determine if the link is <front>, a mailto: link, an internal or external link.
I created a patch that adds a global validation on/off setting (in Site Configuration / CCK Link field, default is on) for URLs. The patch is against 6.x-2.8.
I didn't see an easy way to add this per-field, so it is a global setting.
This setting is useful if you are having users copy and paste URLs often.
For single URLs, I've had some success using the JavaScript URL encoding function at http://www.w3schools.com/TAGS/ref_urlencode.asp. I wasn't able to successfully work in the PHP encoding function.
The patch checks for a valid link first, and if it fails, checks the setting. If it is set to not validate and the link begins with an allowed protocol, EXTERNAL_LINK is returned. If it is set to not validate and there is no allowed protocol, INTERNAL_LINK is returned.
Comment #13
capellicThanks for the patch. Given the popularity of FB and CNN, I hoping that a solution like this is implemented in the next release.
Comment #14
japanitrat commentedRelated to #615642: "/" and "?" should be valid after anchor and #427990: Incorrect fragment handling .. making the validation optional does not seem to be a good solution
Comment #15
jcfiala commentedHey, I've tested the link at the top of this ticket, and it now passes through the validator properly now that #615642: "/" and "?" should be valid after anchor is fixed. However, this is against the 5.x version, so I'll hopefully be able to copy/paste that validator to the 5.x branch and close this soon.
Comment #16
jcfiala commentedOkay, I was able to cut/paste the validation changes from 6.x to 5.x, so this is now fixed in the 5.x branch.
Comment #17
charlie-s commentedFacebook (sloppily) throws requests at its Ajax framework that way. I have actually seen this printed on business cards, direct mail, etc., as bad as:
facebook.com/request1.php?foo=bar#/request2#/business-name
when they could have simply put facebook.com/business-name
(or whatever method they were able to capture at the time for getting to their appropriate page)