Cannot reproduce xf-addon:build-release failure with invalid UTF8 characters in JS

Affected version
2.0.2

W1zzard

Well-known member
#1
When using xf-addon:build-release with a js file in _files that has invalid unicode characters, the minifier will die.

The error message is just:
Code:
  [GuzzleHttp\Exception\ParseException]
  Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON
Maybe this could be improved to point at the actual issue

Problem was in this code, probably due to the currency symbols
Code:
    ts.addParser({
        id: "currency",
        is: function (s) {
            return /^[£$€?.]/.test(s);
        }, format: function (s) {
            return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), ""));
        }, type: "numeric"
    });
 

Chris D

XenForo developer
Staff member
#2
That exact code seems to compile correctly for me:
JavaScript:
ts.addParser({id:"currency",is:function(a){return/^[\u00a3$\u20ac?.]/.test(a)},format:function(a){return $.tablesorter.formatFloat(a.replace(new RegExp(/[\u00a3$\u20ac]/g),""))},type:"numeric"});
Do you have any more examples that reproduce the issue?
 
Top