[open-ils-commits] [GIT] Evergreen ILS branch rel_3_4 updated. 21616b507941b9b35ff092045f10ea0d5d7144ed

Evergreen Git git at git.evergreen-ils.org
Fri Dec 27 15:42:57 EST 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_4 has been updated
       via  21616b507941b9b35ff092045f10ea0d5d7144ed (commit)
      from  23e7b33b1bd9aec5d3e8ce64173ce543a30e896f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 21616b507941b9b35ff092045f10ea0d5d7144ed
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Fri Dec 27 13:21:15 2019 -0500

    LP#1857710: fix Angular client whitescreen on Firefox
    
    Work done for LP#1830391 added an instance of a Javascript
    regexp replace using the dotAll ("/s") flag, but as of the moment
    Firefox treats that flag as a fatal syntax error, breaking the
    Angular staff client.
    
    To test
    -------
    [1] Attempt to log in the Angular staff client with Firefox. Note
        that you get a whitescreen with the following in the browser
        console:
    
        SyntaxError: invalid regular expression flag s
    [2] Apply the patch and repeat step 1. This time, the Angular
        staff client should work normally.
    [3] Verify that the Angular unit tests pass.
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Jason Boyer <JBoyer at eoli.info>

diff --git a/Open-ILS/src/eg2/src/app/share/util/htmltotxt.service.spec.ts b/Open-ILS/src/eg2/src/app/share/util/htmltotxt.service.spec.ts
new file mode 100644
index 0000000000..1d2345c96e
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/share/util/htmltotxt.service.spec.ts
@@ -0,0 +1,15 @@
+import {HtmlToTxtService} from './htmltotxt.service';
+
+let h2txt: HtmlToTxtService;
+
+beforeEach(() => {
+    h2txt = new HtmlToTxtService();
+});
+
+describe('HtmlToTxtService', () => {
+    it('htmlToTxt cleans multiline comments', () => {
+        // this is a regression test for LP#1857710 on Firefox
+        const str = '<h1>A print template</h1> <!-- I am a comment\nwith an embedded newline --> <div>body of template</div>';
+        expect(h2txt.htmlToTxt(str)).toEqual('A print template  body of template');
+    });
+});
diff --git a/Open-ILS/src/eg2/src/app/share/util/htmltotxt.service.ts b/Open-ILS/src/eg2/src/app/share/util/htmltotxt.service.ts
index e265b3d2fa..25b602c3ce 100644
--- a/Open-ILS/src/eg2/src/app/share/util/htmltotxt.service.ts
+++ b/Open-ILS/src/eg2/src/app/share/util/htmltotxt.service.ts
@@ -38,7 +38,11 @@ export class HtmlToTxtService {
         }
 
         // First remove multi-line comments.
-        html = html.replace(/<!--(.*?)-->/gs, '');
+        // NOTE: the regexp was originally /<!--(.*?)-->/gs
+        //       but as of 2019-12-27 Firefox does not support
+        //       the ES2018 regexp dotAll flag and Angular/tsc doesn't
+        //       seem set up to transpile it
+        html = html.replace(/<!--([^]*?)-->/g, '');
 
         const lines = html.split(/\n/);
         const newLines = [];

-----------------------------------------------------------------------

Summary of changes:
 .../src/eg2/src/app/share/util/htmltotxt.service.spec.ts  | 15 +++++++++++++++
 Open-ILS/src/eg2/src/app/share/util/htmltotxt.service.ts  |  6 +++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 Open-ILS/src/eg2/src/app/share/util/htmltotxt.service.spec.ts


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list