Download & Extend

CCK Link URL's with and without http:// should be classified as unique

Project:Unique field
Version:6.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)
Issue tags:link, patch, unique field

Issue Summary

Hi there,

There seems to be a minor issues when using Unique field with the CCK Link module. Unique field treats http://www.example.com and www.example.com as different URL's, which in fact is the same.

CCK Link allow URL's with and without the http part, which I personally find to be bad practice, but now it's like that so perhaps Unique field could make this check?

Thanks!

Comments

#1

Status:active» closed (won't fix)

I can't make this change. I agree that it makes sense, but it compromises the general purpose nature of this module. I suggest reporting this as an issue to the CCK Link module, because it does seem helpful that the URL stored in the database is full and proper.

#2

I also needed this functionality so I created a patch to do this. I realize this is set to won't fix but unique_field seemed like the best place to add this functionality.

I'm sure there are some problems with the patch because I haven't tested some configurations. What the patch does is give the option to do some additional checking for link field types. This can be turned on in the Unique field settings section of the node type settings. I have only tested it with Content Type scope and with the Link set to 1 field.

The patch was made against the 6.x-1.x-dev on Nov. 13th.

AttachmentSize
unique_field_link.patch 4.79 KB

#3

I've added some additional checks for checking whether a link is a unique or not. I'm posting here for whoever is interested.

The additional checks are:

With or without the 'www.' in the domain section of the URL
With or without the 'http://' in the URL
With or without a trailing '/' in the URL
Option to trim clear space before and after the URL.

Additional checks options are available in the Unique field settings section.

AttachmentSize
unique_field_links-6.x-1.x-dev.patch 10.62 KB

#4

hmm, do you actually use the urlMatches or is it just for validation? If this is for validation only, you can also use link_validate_url from the link field module. Although I am happy to have a solution here, I don't think it's the best way to go.