Closed (fixed)
Project:
Hostmaster (Aegir)
Version:
6.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Nov 2011 at 08:04 UTC
Updated:
30 May 2014 at 10:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedThe issue here is that in our invocation of hook_validate(), we implement the hosting_domain_allowed() API hook to see if this is a valid URL or if it has already been taken.
The problem is that hosting_domain_allowed() hook optionally takes an array of parameters as an arg, and in the API hook itself we check if such a parameter was provided called 'nid' and then we append 'IS NOT $nid' to the query. In other words, the result looks something like:
This will return a 0 count because the node in which this URL *does* appear in, is the same node as the site itself, obviously! Take off the AND n.nid <> 10 and you'll get a count of 1, because yes indeed, this URL *is* already in use *somewhere*, just happens to be this very node itself.
However! We can't just drop the nid argument off this invocation, because it prevents us ever editing the site node again (the submission of the form will fail from thereon: we probably found this bug once and that's what we did to fix it)
For this reason I think the only fix is to add an additional conditional in this check to error if the $alias is identical to the $node->title, which should never be allowed. Tested this and it's working for me..
Patch attached.
Comment #2
steven jones commentedLooks good to me! Can you pop fixes in both 6.x-1.x and 6.x-2.x?
Comment #3
Anonymous (not verified) commented