I have looked around the issue queue to see what I might be doing wrong, but I couldn't find anything relevant, so I would like to report the following possible fault:

The Link module allows me to define a field for a URL. It accepts (eg) "drupal.org" as a value and displays it as "http://drupal.org" with the correct hyperlink. But Link checker sticks my domain name on the front to get "http://mydomain.co.uk/drupal.org" and, unsurprisingly, reports this as a broken link. For consistency with Link, I think Link checker should supply the missing "http://" prefix when checking for a broken link.

CommentFileSizeAuthor
#6 1535594-6.patch1.12 KBa.mikheychik
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hass’s picture

Title: Link checker inconsistent with Link module? » Allow other modules to reuse the link building logics
Project: Link checker » Link
Version: 7.x-1.0-beta1 » 7.x-1.0
Category: support » feature
Issue tags: +API

Hm... well... maybe... the better would be if you add the http:// correctly to the link.

I have no idea how I should detect relative paths. Someone can enter "mycustom/path/to/asubdir" and in this case it's base path is the node path. This is how link field works as I know, too. I'm not sure how it is able to detect you incomplete hostname... link modul is really doing some strange things and I cannot reuse any function from this module yet. I tried it, but failed.

We need API function from link module I can just call and get the link back how it should be rendered per link module rules. Otherwise I need to guess and this is the bet guess.

timjh’s picture

Thanks for your response, and I'm sorry about the duplication - I couldn't find my original post and got no notifications even though I was following it, so I assumed it had gone down a black hole.

I would have thought that the presence of dots and high level domain codes would be very suggestive of a url that is intended to be absolute, and at least worth a try with an http:// prefix before perhaps going on to try a relative path. But, having said that, your approach of using a Link field API sounds like a better engineered solution. Meanwhile I suppose I will have to go through several hundred links and insert the http:// prefix :-(.

hass’s picture

Not really... you can have paths with dots... very common.

hass’s picture

a.mikheychik’s picture

FileSize
1.12 KB

Here is my patch for this.

hass’s picture

Version: 7.x-1.0 » 7.x-1.x-dev

This is not an API function for the link module, that other modules can call.

barraponto’s picture

Isn't there a PHP library for that? Something that can figure out domain names, build queries (?) and fragments (#), and all sorts of stuff we might be duplicating here?

areikiera’s picture

Any progress on this?

Comment #6 is a patch to LinkChecker. Should that patch be provided here (http://drupal.org/node/1546954), and perhaps updated for the most recent version of LinkChecker? Or is this still primarily a Link module issue?