Take the 2-minute tour ×
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It's 100% free, no registration required.

We're using the extension from SDLTridionWorld to process download links, http://sdltridionworld.com/community/2011_extensions/process-download-links.aspx. We found an issue with the extension where the first anchor in the rendered output is not processed.

We have enabled viewing the debug log and ran the TBB in TemplateBuilder. The extension's log states that it is found, but isn't replaced. We've also tried running it against different PDFs, but the issue persists. What could be the cause?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

I took a look at the markup for the component being tested on. The markup looks as follows:

<article>
  <a tridion:href="tcm:44-32740">Test Hyperlink</a>
</article>

Looking at the ProcessDownloadLinksInOutput.cs, the regex expression matching anchor tags is incorrectly identifying the article tag as an anchor tag.

<(a[\s\S]*?)>([\s\S]*?)<\/a>?

The regex is searching for any tags beginning with an anchor 'a', followed by a repeatable sequence of a whitespace non-whitespace characters. Replacing the regex with the following will fix the problem (match any tags opening with 'a' with an immediately following space):

<(a\s[\s\S]*?)>([\s\S]*?)<\/a>?
share|improve this answer
3  
Thanks for catching this! I will update the extension code as soon as I can. As mentioned in the article the extension was not tested in production, so I am glad that people use it and that we can improve it to make it more production ready. –  Philippe Conil Dec 17 '13 at 18:47
    
A very useful extension indeed! Thanks for sharing it @PhilippeConil. –  Nickoli Roussakov Dec 17 '13 at 20:49

This is a community tool, so it perhaps hasn't gone through the sort of testing you'd expect for a production ready release, I'd run through the code through a debugger to check:

  • If the regex used is correctly grabbing all the links
  • If your links contain anything strange that's stopping the regex from working
  • If the code to loop through all the items in the regex match is ignoring a link for a particular reason, could it me that one of the items isn't published?
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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