Personal Blog of Thomas Hampel - Creative Mythbusting in Development and Collaboration

Bug in DominoBlog template

Thomas Hampel
 12 June 2012

For some reason it wasnt possible to use embedded images within blog postings, looking at the HTML source of the resulting web page showed that some piece of HTML code was inserted when saving the document.
Image:Bug in DominoBlog template
After some debugging, I figured out that it was caused by the scriptlibrary "DXNotesContentProcessing" where the function "autoCreateLinks" is the one to be looked at.


Function
autoCreateLinks(strIn As String) As String
   
If configdoc.config_createlinks(0)="Create Links" Then
           
'Search for text and replace with link
           autoCreateLinks=strIn

           
Dim view As notesview
           
Dim docLink As NotesDocument
           
Set view=db.getview("vLinksDesc")
           
Set docLink=view.GetFirstDocument
           
Do Until docLink Is Nothing
                   
If Instr(autoCreateLinks," "+docLink.linktext(0)+" ")>0 Then
                           autoCreateLinks=R5replaceSubstring(autoCreateLinks,
" "+docLink.linktext(0)+" ",{ <a href="}+docLink.link(0)+{" title="}+docLink.linktext(0)+{">}+docLink.linktext(0)+{</a> })
                   
End If
                   
Set docLink=view.GetNextDocument(docLink)
           
Loop
   
Else
           autoCreateLinks=strIn

   
End If
End
Function

This function is used to replace a piece of text with the URL configured for it. Its using the links from "Configuration\Links" to search for any entry where the field "Link Text" is matching the HTML string.
Bad luck if one created links like this one, where no link text is specified:

Image:Bug in DominoBlog template


which causes the function above to search for the occurance of 2 spaces "  ", which unfortunately is true for embedded images... actually they are located directly behind the tag.

Image:Bug in DominoBlog template

Workaround
  • Turn off "Auto Create Links from Link List" located in the configuration document of the blog under "Site Settings\Content Creation"
  • Make sure that all links in "Configuration\Links" are created with a propper link text

What about a permanent fix?

Modify the form "Link" and add an input validation formula to the field "linktext" as shown below.

Image:Bug in DominoBlog template
Comments [0]
Tagged with: Development
Go ElsewhereSubscribe to RSSAboutStay ConnectedAnd More
Thomas Hampel, All rights reserved.