269 views

Description

Invalid HTML code added with the [code] element to journal fields (sys_journal_field, sys_history_line) produce entries the display as blank and produce the Angular error Error: [$sanitize:badparse].

Steps to Reproduce

  1. On UI16+, navigate to Incident > Open and select an incident.

  2. Add invalid HTML text using [code] ... [/code] tags to a Work notes field.

    For example, copy the following text and click Update.

    [code]
    <p align="center"style="">Tag attributes have no space between them</p>
    [/code]

    Note – Do not include a space between "center" and "style."

    Note that a blank comment or Work note is added and the JavaScript console displays the following message:

    Error: [$sanitize:badparse] http://errors.angularjs.org/1.4.8/$sanitize/badparse?p0=%3Cp%20align%3D%22center%22style%3D%22%22%3ETag%20attributes%20have%20no%20space%3C/p%3E

    Error: [$sanitize:badparse]

 

Workaround

Ensure that the HTML tags that are added using [code]... [/code] are valid on journal fields

Several workarounds are available:

  • Instead of using the [code] tag, use the text version or strip the text from the HTML instead.

  • Switch to UI15.

  • Make the code tag visible by setting the glide.ui.security.allow_codetag system property to false.

  • Create scripts to fix the malformed HTML, for example, using regular expressions. The following example applies to the test case:

    --background script -----
    gs.print(addspacesmissingonhtmltags(
        '<a href="https://www.google.com"target="hello"stuff="things" omg="wow">stuff " and things" </a>'
    ));

    function addspacesmissingonhtmltags(a) {
        return a.replace(/(\B"\w+[^"]*")/g, "$& ")
    };
    --background script -----

    Result:

    [0:00:00.004] Script completed in scope global: script
    *** Script: <a href="https://www.google.com" target="hello" stuff="things"  omg="wow" >stuff " and things" </a>


Related Problem: PRB660886

Seen In

Geneva Patch 1 Hot Fix 5
Helsinki Patch 2

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-02-02 01:39:29
Published:2017-03-09