For the uri data type entity_property_verify_data_type calls valid_uri() with the absolute parameter set to TRUE. This seems overly restrictive as a valid URI does not have to contain a scheme.

This also prevents saving what would be considered a valid URI value for the link field through the entity_metadata_wrapper, ex:

This will succeed:

$node = node_load(123);
$wrapper = entity_metadata_wrapper('node', $node);
$wrapper->field_link->url->set('http://test.com');
$wrapper->save();

While this will fail:

$node = node_load(123);
$wrapper = entity_metadata_wrapper('node', $node);
$wrapper->field_link->url->set('test.com');
$wrapper->save();

Comments

epicflux created an issue. See original summary.

epicflux’s picture

StatusFileSize
new610 bytes
epicflux’s picture

Status: Active » Needs review
epicflux’s picture

Title: entity_property_verify_data_type() should not enfource an absolute URI » entity_property_verify_data_type() should not enforce an absolute URI
bdone’s picture

Status: Needs review » Reviewed & tested by the community
fago’s picture

Status: Reviewed & tested by the community » Closed (works as designed)

Maybe, but this is how it's documented and has been for years. Changing the spec now does not help anyone, as every module supporting 'url' type values would have to adapt, what makes a rather drastic API change at this point. Given that, link module would have to adapt it's getter callback and translate the relative urls to absolute ones.