Thanks very much for this useful module.

This problem is not unique to RC3, I just encountered it while still using RC2 and confirmed it still occurs with RC3. When trying to add a weblink for http://wwwn.cdc.gov/travel/default.aspx which is a strange but valid url there is a weblink error: "That does not look like a valid URL". See attached screen capture. This suggests that possibly the order used in evaluating a url before testing the connection may need to be reconsidered.

Thanks,

Izzy

CommentFileSizeAuthor
cdc travel health link.jpg16.09 KBizmeez
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rmiddle’s picture

OK that url is working right now. I don't see a reason for it to fail. This is the code that generates the error so I don't have to look it up later.

if (!valid_url($node->url, TRUE)) {
form_set_error('url', t('That does not look like a valid URL.'));
}

Thanks
Robert

rmiddle’s picture

Status: Active » Postponed (maintainer needs more info)

Can't duplicate the error. I have tried in both Drupal 5 and 6.

Thanks
Robert

NancyDru’s picture

I entered that URL with no trouble. Could you, perhaps, have had a space at the beginning or the end?

NancyDru’s picture

Robert, perhaps we should add a trim() to the validation.

izmeez’s picture

I have just tested with other url's and none of them are working for me now, so it is likely related to some other conflict. I am using TinyMCE and not sure if this may be contributing.

I have also recently upgraded from Drupal 6.3 to 6.4 and also have other modules in use. I did find the taxonomy vocabulary settings were deactivated with the upgrade as happened from 6.2 to 6.3 upgrade and reported that in another issue.

I will have to explore this problem and report back.

Thanks very much,

Izzy

izmeez’s picture

Title: Weblinks order for checking url fails with weird url » Weblinks no longer able to create any urls

Well, this has become quite strange. I still have no clear idea what is happening.

As things were not working well I decided to completely disable and uninstall Weblinks. When I did disable weblinks and then executed uninstall I got a listing of each link "has been deleted" followed by the statement weblinks module uninstalled and the selected modules have been uninstalled followed by the error:

"warning: Missing argument 2 for variable_get(), called in .../public_html/sites/all/modules/weblinks/weblinks.install on line 250 and defined in .../public_html/includes/bootstrap.inc on line 452.

I then emptied all caches and tried re-enabling weblinks RC3 and got the following error:

user warning: Key column 'tid' doesn't exist in table query: CREATE TABLE weblinks (`nid` INT unsigned NOT NULL DEFAULT 0, `vid` INT unsigned NOT NULL DEFAULT 0, `click_count` INT unsigned NOT NULL DEFAULT 0, `last_click` INT unsigned DEFAULT 0, `weight` TINYINT NOT NULL DEFAULT 0, `last_status` CHAR(4) DEFAULT '200', `last_checked` INT unsigned DEFAULT 0, `url` TEXT NOT NULL, PRIMARY KEY (nid, vid), INDEX tid (tid), INDEX url (url(2048)) ) /*!40100 DEFAULT CHARCTER SET UTF8 */ in .../public_html/includes/database.inc on line 514.

and

user warning: Table 'myaccountname_drpl1.weblinks' doesn't exist query: SELECT n.nid FROM node n INNER JOIN node_revisions nr ON nr.vid = n.vid INNER JOIN weblinks bw ON bw.vid = nr.vid LEFT JOIN term_node tn ON tn.nid=n.nid AND tn.vid=n.vid WHERE n.status = 1 ORDER BY n.changed DESC, n.title ASC LIMIT 0, 10 in .../public_html/sites/all/modules/weblinks/weblinks.module on line 1028

followed by:
weblinks module installed
The configuration options have been saved.

However, the errors continue to show at the top of every page.

I have disabled and uninstalled weblinks and am not really sure what to do. I worry if I have corrupted my database but have a backup if needed. Any suggestions would be welcome. Thanks,

Izzy

NancyDru’s picture

No, you didn't corrupt your database. You did find two typos in the .install file. I just committed the fix. It will roll up in the next -dev version (at Noon GMT).

However, uninstalling any module is going to delete any content that the module created, so all your links are gone.

If you want to manually fix the typos, go into the weblinks.install file:

  1. Locate the line (around 86) that reads 'tid' => array('tid') and delete the whole line.
  2. Go down to almost the end (around 250), and locate variable_get('weblinks_user_links') and change it to variable_del('weblinks_user_links')

My apologies for these errors.

TinyMCE (actually, any WYSIWYG editor) is known to cause problems and is almost certainly the problem here. They have documentation on how to disable TinyMCE on a field by field basis. Please try turning it off for Web Links.

izmeez’s picture

Yes, I realized the web links would all be lost by uninstalling but thought it might help in resolving why I can no longer create weblinks by any name. Anyway, I'm glad it helped to identify another problem.

I have tested the dev version and it no longer gives error with enabling. Unfortunately, my problem with creating weblinks remains and I have had limited time to experiment. I have not yet mastered how to turn off TinyMCE field by field and I have my doubts that will be the issue as it was all working before with Tiny two weeks ago.

Thanks,

Izzy

NancyDru’s picture

izmeez’s picture

Nancy,

Thanks,

I have not yet had time to implement the disabling of TinyMCE for dynamically named text areas but have confirmed that it is TinyMCE that is causing the conflict with WebLinks. When TinyMCE is deactivated, weblinks works fine.

I will have to explore the information you have provided. I am also wondering if it is something particular in the Tiny profile that we have activated in the past two weeks.

Thanks,

Izzy

rmiddle’s picture

Izzy,

The coversion to text areas happened in the beta version. It has been over a month since that change was made.

Thanks
Robert

PS. Nancy yea we should trim the URL just in case.

NancyDru’s picture

Status: Postponed (maintainer needs more info) » Fixed

Trim fix committed to both branches.

izmeez’s picture

Just for clarification, I only started using weblinks a little under three weeks ago with the RC1 version. At that time I already had TinyMCE installed and at first everything was working fine. Unfortunately, we have implemented a number of changes in the past two weeks including some changes to the configuration of TinyMCE editing profile along with testing various other modules and updates so I am unable to identify the cause of our current difficulties. It certainly appears to be related to a conflict with Tiny somewhere along the way. Sorry, I can not pinpoint it more accurately and I can see this is not directly a weblinks problem although it may require some additions to the documentation such as Nancy has offered in this thread. I will keep you posted as we get time to resolve this issue.

Thanks very much for your prompt response to all the questions and for a very useful module.

Izzy

NancyDru’s picture

Izzy, when we fixed #284463: URL length needs to be increased, it was necessary to change from a textfield to textarea; that brought any WYSIWYG editor into the mix. The Drupal developers are aware that these editors are a big nuisance to contrib developers and some work is being done to address it, but don't hold your breath for seeing it soon. See Wysiwyg API.

nirvanajyothi’s picture

Sorry for interrupting!

I need to upgrade from weblinks 6.x -rc2 to rc3...so which tar should i use 6.x-1.0-rc3 or 6.x-1.x-dev released on Aug 27 to avoid the error that has been solved here.

NancyDru’s picture

The -dev version is the most current and has the fixes from #7 and #12. Please make sure you use update.php.

rmiddle’s picture

Unless something pops up I will doing rc4 on Monday. And that will likely be the last RC before release.

Thanks
Robert

wyoshimu’s picture

Version: 6.x-1.0-rc3 » 5.x-2.0-rc2

We also have suddenly come across the "That does not look like a valid URL." problem when creating certain Weblinks nodes.
using Weblinks modules versions 5.x-2.0-rc3 and 5.x-.1.15

(although it does not seem to occur with an older version of the module 5.x-1.8 that I have used on a development server)
I have noticed that our issue does seem to revolve around certain non-alphanumeric characters (namely the "^" character) which seem to always trigger the error message.
I have tried with turning off the "Check if link is valid when entered" option and also disabling TINYMCE with no effect.
Any suggestions?

rmiddle’s picture

wyoshimu,

Are you using a full screen editor?

Thanks
Robert

NancyDru’s picture

@wyoshimu: Try the -dev version, please. You would not have seen this in 1.8 because the feature didn't exist then. However, we cannot do anything about TinyMCE, which seems to be unsupported. Please either disable it or use the information in the link above to turn it off for Web Links.

wyoshimu’s picture

Status: Postponed (maintainer needs more info) » Fixed

No sorry Nancy, the Dev version is not working either...
TinyMCE is off.
I even also tried it with a brand new empty vanilla database (drupal 5.6 and 5.10) so no other modules besides core are running.

I can send you a sample of a link if you would like...

Virtually all links are fine and it will allow the Weblinks node be created (valid or not valid URLs), except when the ^ character is in the URL.

rmiddle’s picture

Status: Fixed » Postponed (maintainer needs more info)

wyoshimu,

Does update_status or Aggregator work on your site? My hosting provider had turned off outbound connections on there hosting sites at one point. I had to have my account added to a list of sites that could make outbound connections. We use the same method to get data as those two modules. Also I have found that IIS sometimes returns 302 even for valid links. Are you getting the same error this isn't a valid link? or has the error changed?

Thanks
Robert

rmiddle’s picture

Status: Fixed » Postponed (maintainer needs more info)

I added the URL into the error message so it will kick back the URL to you in case something is getting inserted by something like full screen editor.

NancyDru’s picture

@wyoshimu: Can you test something for us with your complex URLs, please?

Go to approximately line 844 (in weblinks_validate), where you will find:

  $url = trim($node->url);

and change it to:

  $url = drupal_urlencode(trim($node->url));

We think the core "valid_url" test is choking on those unencoded special characters.

wyoshimu’s picture


Sorry I am now getting an error message when I am trying to upgrade the php with any weblinks module greater than weblinks-5.x-1.15.tar.gz

"user warning: Unknown column 'last_status' in 'field list' query: SELECT url, weight, last_status, last_checked, click_count, last_click FROM weblinks WHERE nid = 2 AND vid=2 in C:\wamp\www\includes\database.mysql.inc on line 172."
"szAppName : mysqld-nt.exe szAppVer : 0.0.0.0 szModName : mysqld-nt.exe
szModVer : 0.0.0.0 offset : 002604e6"

...
so I haven't yet been able to test changing the $url = trim($node->url); yet.

Before my new crash oddity... I did manage to test Robert's URL feedback addition (once or twice) and the returned URL was exactly the same except instances of "&" were replaced with "<&amp;>". All instances of the ^ were still there.

wyoshimu’s picture

OK, non-related errors sorted out (had to run cron before update).

I've tested your suggestion to change line 844 (in weblinks_validate) combined with Roberts additional feature to spit back the URL show me that it will change all the non-alphanumerics to their URL-safe counterparts (ie : becomes %3A, ^ becomes %5E) but unfortunately the changed URL still does not work (cut and pasted back to browser)
And same error message is provided.
"link", does not look like a valid URL.

Without the change in line 844. The URL that was spit back changed only some of the characters to their UNIcode counterparts (ie & to &amp;) but others stayed the same (ie ^). And the changed link (cut and pasted) once again did not function independently in a browser.
Error message is still same..
"link" does not look like a valid URL.

Here is an example of a link that I am attempting to link to...
http://thoth.lib.ucalgary.ca/uhtbin/cgisirsi/0/X/0/57/5/3?searchdata1=^C2671933&searchfield1=GENERAL^SUBJECT^GENERAL^^&user_id=WEBSERVER

PS It seems as though that link might get chopped off by the Drupal forum so here it is again in two lines.
http://thoth.lib.ucalgary.ca/uhtbin/cgisirsi/0/X/0/57/5/3?searchdata1=^C2671933&searchfield1=
GENERAL^SUBJECT^GENERAL^^&user_id=WEBSERVER
(sigh, if it isn't one thing... its another..)

NancyDru’s picture

Okay, thanks. Now we know that's not the problem. The RFC is not clear on whether a caret is legal in a URL, although I think it is. And you've given me a sample to work with. I suspect we have a core bug.

NancyDru’s picture

Status: Postponed (maintainer needs more info) » Postponed

It is indeed core: #295021: filter_var() with FILTER_VALIDATE_URL accepts malformed URLs and rejects not all valid URLs

@Robert: do we want to try some kind of work_around?

NancyDru’s picture

@wyoshimu: Okay, I copied and fixed the patch from that issue. It looks good on my test sites. Can you please test it and let us know. We want to roll a new release if this takes care of your problem.

rmiddle’s picture

Status: Postponed » Postponed (maintainer needs more info)
NancyDru’s picture

According to RFC1738, the URL you show is actually invalid.

Characters can be unsafe for a number of reasons. The space character is unsafe because significant spaces may disappear and insignificant spaces may be introduced when URLs are transcribed or typeset or subjected to the treatment of word-processing programs. The characters "<" and ">" are unsafe because they are used as the delimiters around URLs in free text; the quote mark (""") is used to delimit URLs in some systems. The character "#" is unsafe and should always be encoded because it is used in World Wide Web and in other systems to delimit a URL from a fragment/anchor identifier that might follow it. The character "%" is unsafe because it is used for encodings of other characters. Other characters are unsafe because gateways and other transport agents are known to sometimes modify such characters. These characters are "{", "}", "|", "\", "^", "~", "[", "]", and "`".

All unsafe characters must always be encoded within a URL. For example, the character "#" must be encoded within URLs even in systems that do not normally deal with fragment or anchor identifiers, so that if the URL is copied into another system that does use them, it will not be necessary to change the URL encoding.

So what do we do now?

rmiddle’s picture

Status: Postponed (maintainer needs more info) » Active

I guess we encode the string and if it still doesn't work then he will have to turn off validation. We will now need to make sure that we can turn off that check.

Thanks
Robert

NancyDru’s picture

I have tried every type of encoding I know about (and a couple I didn't) to no avail. And it seems the core developers are kicking back on this.

rmiddle’s picture

As I said we try and encode the imput and make sure it still works on standard links. If it doesn't work right we just do what we are doing right now. He will have to turn off validation since he is entering a none standard url. We might want to revisit the idea of not checking certain URL as well.

Thanks
Robert

ddlb’s picture

running D6.4
I had same issues with not valid link, I tried the new releases..not work either..
Would not take a url even with the verify off. The listing was there, the row would expand, but no link would show. The node was created, and you could view it.

had to go back to weblinks-6.x-1.0-rc2...still with it...
I really like this module, works right out of the box, great for us newbee's

NancyDru’s picture

Status: Active » Postponed (maintainer needs more info)

What was the URL?

ddlb’s picture

if you are asking me it's on www.buckeyelake.org but like i said it's got rc2 installed.
i had to take the newer ones out so i could have the page up.

NancyDru’s picture

Well, what I really wanted to know was the URL that caused the failure. As we have pointed out there is a core bug here and we are trying to help the core developers get it fixed as well as trying to find a way around it that works now.

wyoshimu’s picture

Thank you Nancy,
I've tested 5.x-2.0-RC6 on my development server and it seems to have everything in place for the complex URLs to be happy (or at least the complex URLs that I am using). It will take me a day or so to have it implemented on our live server but I think you have it solved.
If I could send a fruit basket down the hall to your desk, I would.
Thank you once again for all your brilliance.

NancyDru’s picture

@wyoshimu: Thanks for the update. Because of another issue report, can you, please, tell me which PHP version you are using?

wyoshimu’s picture

No problem Nancy,
on my test server
PHP 5.2.5
This is the version that I had tested this morning and seems to have resolved the ^ problems.

I'll still have to confirm the version on the live servers though.

rmiddle’s picture

Title: Weblinks no longer able to create any urls » Can't great an URL with a ^ caret in it.
wyoshimu’s picture

The 'Live' server is running PHP 5.2.6
Both were experiencing same ^ symptoms with weblinks modules 5.x-1.15 to 5.x-2.0-rc3 but have not been fixed with 5.x-2.0-rc6

rmiddle’s picture

Title: Can't great an URL with a ^ caret in it. » Can't create an URL with a ^ caret in it.

^ isn't a valid char according to the RFC. We aren't sure what are going to do.

NancyDru’s picture

Well, it is valid - but it must be encoded. Unfortunately, I haven't found any encoding routines that actually do a caret.

NancyDru’s picture

Assigned: Unassigned » NancyDru
Status: Postponed (maintainer needs more info) » Fixed

The problem stems, apparently, from an incorrect understanding of the PHP urlencode() function in the drupal_urlencode routine. Urlencode is supposed to be run only on the query part of the URL, not the whole thing. So I changed the code to take the URL apart, encode the query string, and then put back together. Now we seem to be all happy.

Fix committed to both branches.

NancyDru’s picture

Status: Fixed » Closed (fixed)