Active
Project:
Flexinode
Version:
4.6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
21 Jan 2005 at 15:07 UTC
Updated:
30 Jan 2006 at 05:24 UTC
Jump to comment: Most recent file
Comments
Comment #1
robclay commentedThere is a URL Link field? How do I create that?
Comment #2
alicia commentedI agree this is a problem. It's a hassle to explain to people that they should strip the http:// from their link since that's already hardcoded into the flexinode URL field. Since most people are copying and pasting links directly from their browsers, this shouldn't be the default behavior.
Comment #3
(not verified) commentedIts not even that. The input filter for this field is doing some strange validity testing. If you actually enter a proper URL, it passes the validity check and creates a bad link. If you enter the abbreviated reference (omitting http://) it flags the field as being invalid.
In fact, what it should be doing is accepting any valid URL (including non-http URLs) and then normalizing internal references to the Drupal site.
Comment #4
czarphanguye commentedTemp fix...
locate field_url.inc
I just commented out the 'verification' checks and also removed the 'http://' (causes users to HAVE TO place http://www.example.com in the url field).
Comment #5
mcd commentedI noticed this problem as well. Thanks for pointing out the validation problems. A patch for the changes above is attached.
Comment #6
syscrusher commentedHere is a patch to the CVS version that does not require disabling the validation. This allows users to enter URLs in any of the following formats (assuming the local site is "http://example.com/":
* A Drupal URL, e.g., "node/123", which will link as "http://example.com/node/123"
* An absolute local URL, e.g., "/somedir/bozon.php", which will link as "http://example.com/somedir/bozon.php"
* An absolute URL, e.g., "http://www.example.org/blah/abc.html", which will link exactly as shown.
* An absolute URL with a different protocol spec, such as "ftp://ftp.example.com/pub/myfile.tgz", which links exactly as shown.
***BEGIN PATCH***
--- field_url.inc 2005-03-26 16:14:50.513087708 -0500
+++ field_url.inc.new 2005-03-26 16:13:17.292388394 -0500
@@ -40,7 +40,10 @@
function flexinode_field_url_format($field, $node, $brief = 0) {
$fieldname = 'flexinode_'. $field->field_id;
$output = drupal_specialchars($node->$fieldname);
- return $output ? ''. $output .'' : '';
+ if (strlen($output) && ! preg_match('%^(\w+://|\w*/)%',$output)) {
+ $output = 'http://' . $output;
+ }
+ return $output ? ''. $output .'' : '';
}
function flexinode_field_url_config($field, $edit) {
***END PATCH***
For those who wish to examine this in a more readable format, here is the old and new code for the entire function:
***OLD***
function flexinode_field_url_format($field, $node, $brief = 0) {
$fieldname = 'flexinode_'. $field->field_id;
$output = drupal_specialchars($node->$fieldname);
return $output ? ''. $output .'' : '';
}
***END OLD***
***NEW***
function flexinode_field_url_format($field, $node, $brief = 0) {
$fieldname = 'flexinode_'. $field->field_id;
$output = drupal_specialchars($node->$fieldname);
if (strlen($output) && ! preg_match('%^(\w+://|\w*/)%',$output)) {
$output = 'http://' . $output;
}
return $output ? ''. $output .'' : '';
}
***END NEW***
I will attach the patch file to this update as well.
Comment #7
syscrusher commented*** ARGH! My previous attempt to post this, I forgot to escape the HTML tags inside the code. Sorry! ***
Here is a patch to the CVS version that does not require disabling the validation. This allows users to enter URLs in any of the following formats (assuming the local site is "http://example.com/"):
***BEGIN PATCH***
***END PATCH***
For those who wish to examine this in a more readable format, here is the old and new code for the entire function:
***OLD***
***NEW***
I will attach the patch file to this update as well.
Comment #8
MJoyce-1 commentedI'm getting this utl link problem and I think I'm using a later version.
$Id: flexinode.module,v 1.46.2.2 2005/05/02 16:37:16 JonBob Exp $
Should these fixes be rolled into v4.6 ?
Comment #9
boris mann commentedThis patch has still not been applied to the 4.5 version.
Comment #10
laura s commentedThis problem persists in version 4.6, the tarball of which still dates to May 2.
As a temporary fix, I'll try the manual disabling of the verification. But as this is a rapidly growing community site I'm having this problem with, I hope the either/or patch is coded for 4.6 soon.
Thanks.
Comment #11
mzabala commented4.6+ version of field_URL.inc
tested on Civicspace 0.8.1
Comment #12
dwwcomment #11 forgot to include the "<a href" part, so links weren't clickable. here's another version of flexinode_field_url_format for 4.6.0 flexinode (patch to contrib/field_url.inc included) based on the above suggestions but that provides working links. also, my copy preserves what the user specified as the thing that's displayed, while the underlying URL has the proper "http://" to work. so, if they input "www.drupal.org" that's what they'll see, even though the resulting link will be www.drupal.org. enjoy...