Navigating to a KnowledgeBase article on the Service Portal does not show images embedded in the KB article.
A user either does not see an image at all, or sees a broken icon:
For the issue to be seen, two scenarios are required:
- The images were added to the KB article by uploading images from the user's computer, so the anchor tag for the source of the HTML contains a reference to the sys_attachment table:
- The URL contains an extra slash after the Portal ID and before the question mark. For example, this URL may see the issue:
Note that a user may not be navigating directly to the Service Portal to cause the issue, but may be redirected using the glide.entry.first.page.script property with the Script Include SPEntryPage.
Steps to Reproduce
- Create a KnowledgeBase article.
- Add an image to the article using type Attachment and upload an image from the local machine
- Inspect the Source Code for this HTML article - note how the anchor tag contains a reference to the sys_attachment table:
- <img src="sys_attachment.do...
- Insert another image, but this time, type Image Library. Note how the anchor tag is a direct reference to the image:
- <img src="file.png"
- Load the KB article on the Service Portal. Ensure there is NO forward slash character between the Service Portal ID sp and the question mark ?.
- Note how both images are rendered correctly.
- Add a forward slash between the Service Portal ID and the question mark:
- The first image will now NOT be seen, showing either no image or a broken image icon. The hyperlink to the image (as shown in the browser developer console) will be similar to the following:
The URL is incorrect as the reference to the sys_attachment record should not reference the Service Portal ID /sp.
The platform is unable to process the hyperlink to the attached image due to the extra forward slash in the URL. The image attached from the Image Library is rendered correctly.
Note: the Source Code for an HTML element can be viewed using the following icon on the HTML editor toolbar:
To workaround the issue, consider the following:
- Ensure any defined hyperlinks on the Service Portal are not directing the users to a URL with the forward slash before the first question mark. The forward slash is not added by default to hyperlinks within the Service Portal.
- If the user is being redirected to the Service Portal on login, then the Script Include SPEntryPage may be in use. This Script include redirects the URL to the Service Portal, but may include a forward slash after the Portal ID. This forward slash is hard coded in the Script Include, but can be configured to remove it: Configure the Service Portal login page
- Rather than attaching images to KB articles using file attachments, consider storing the images to the instance. Attached files of type Image Library do not have this issue.
- If the issue only affects a small number of images, the source HTML can be updated directly. Edit the article, then select Source Code in the HTML editor. Locate the image references and update any URLs to include a forward slash before the reference to sys_attachments:
Related Problem: PRB1102179