4

I have recently upgraded from 2013 to Web 8.5. We are now running into an issue with our external link field.

For our content, this field is sometimes a URL but can also be a token that our CD code resolves. However, now in 8.5 it looks like the external link field type is validated to make sure it is a valid URL.

Is there a way to turn that off? Or is my best option to change the field type and update any of the code that this effects? The only docs I can find all talk about UGC validators or custom validators.

Update: Adding error details.

XML validation error. Reason: The 'http://www.w3.org/1999/xlink:href' 
attribute is invalid - The value 'mailto:{{pa_region_email}}' is invalid 
according to its datatype 'http://www.w3.org/2001/XMLSchema:anyURI' - The 
string 'mailto:{{pa_region_email}}' is

XML validation error. Reason: The 'http://www.w3.org/1999/xlink:href' 
attribute is invalid - The value 'mailto:{{pa_region_email}}' is invalid 
according to its datatype 'http://www.w3.org/2001/XMLSchema:anyURI' - The 
string 'mailto:{{pa_region_email}}' is not a valid Uri value.

As you will see the token in this field is {{pa_region_email}} this is the same token we have always had. XML validation would have changed but we do also have a GUI extension (same one and code base as in 2013). Digging more into XSD or GUI config.

  • I'm able to save an external link with the value "blah", which is clearly not a valid URL. I don't see anything in the release notes about this change either. So either I'm not understanding the issue correctly, or you have something on your environment that I do not. – Peter Kjaer Nov 29 '17 at 10:14
  • ^ or the token contains a character that may now be invalid? Can you post the exact error and an example token? - also, do you have any GUI extensions installed that could be at play? – Dylan .. Mark Saunders Nov 29 '17 at 10:36
  • Please edit your question and provide the details that are asked about in the comments, it will help in getting relevant answers – Bart Koopman Nov 29 '17 at 10:46
  • @ToddB, As suggested by Peter, there is no change in external link field behavior(specifically for any validation) while migration from Tridion 2013 to Web 8.5. Can you check if there is any field validation implemented in the schema using xsd or any event system code or GUI extension code implemented for external url field. – Mukesh Kumar Nov 29 '17 at 11:17
3

In Web 8.5 indeed the value mailto:{{pa_region_email}} is not accepted, since when using mailto, it seems to expect something in the form of mailto:a@b.c.

However if you would just use {{pa_region_email}} and have that add the mailto: protocol itself, then you seem to pass the validation a bit easier.

It indeed seems that Web 8.5 introduced a fix to an issue which was there in 2013 which you had exploited so to speak (I can't find a mention of the specific fix, but it could have happened as a side effect of something like an upgrade of prerequisite etc.). That is assuming the error message is indeed correct and mailto:{{pa_region_email}} is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:anyURI'. In case that might not be true, I would suggest that you report that as a defect at Customer Support.

  • Yep that is indeed the issue. After playing a bit more the issue is due to the type of the external link being mailto: and it validating an email follows. Don't like the idea of having the code that replaces that token have to deal with the concern that it is an email and in a Tridion link field so know to append mailto: – ToddB Nov 29 '17 at 16:39
1

I've done some tests with a java xml/xsd validator, and here it looks like the mailto:{{some_string}} is a valid anyURI.

This XML is valid using the XSD below.

 <?xml version="1.1"?>
 <AnyURI_Test>
   <AnyURI href="mailto:{{pa_region_email}}"></AnyURI>
 </AnyURI_Test>

XSD :

<?xml version="1.1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="AnyURI_Test">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="AnyURI">
       <xs:complexType>
        <xs:attribute name="href"
                      type="xs:anyURI"
                      use="optional" />
       </xs:complexType>
     </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:element>
</xs:schema>

Off course, i'm not entirely sure if this corresponds to the xsd that SDL Web 8.5 uses. Also, maybe the java validation has a different implementation than the .NET one used in SDL Web. Might be good to check this with SDL support.

  • it for sure is an issue with the externalLink when the type is set to mailto. If that type is set to that the data that follows it has to be an email. Not totally clear on what you are testing here and if it aligns. If in the UI though you select external link and set the type to mailto you have to provide an email. – ToddB Nov 29 '17 at 23:06
  • the only thing I was testing is that an XSD that specifies an AnyURI type for a field would accept or reject the string {{token}}. If you are saying this only happens when the field type is set to mailto, then there is most likely more validation than just the validation against AnyURI (so probably there is a check for a valid email) – Harald Hoffelinck Nov 30 '17 at 8:24
  • I still don't know what actually validates the xsd:anyURI, but datypic.com/sc/xsd/t-xsd_anyURI.html seems to suggest that when using a absolute URI like mailto: it needs to be followed by a valid email address. – Bart Koopman Nov 30 '17 at 9:43
  • yes, it looks indeed like it's looking for an email address. The following value is accepted for example in a mailto link field : {{some_string}}@test.com – Harald Hoffelinck Nov 30 '17 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.