Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions js/owrap.oJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,11 @@ OpenWrap.oJob.prototype.__loadFile = function(aFile, removeTodos, isInclude) {
var _r = $rest({ throwExceptions: true }).getBytes(url);
_r = String(Packages.openaf.AFCmdBase.afc.dbIP(_r));
if (isString(_r)) {
_r = af.fromYAML(_r, true);
try {
_r = af.fromYAML(_r, true);
} catch (e) {
throw "Failed to parse encrypted YAML from URL '" + url + "'. The content may not be properly encrypted or the decryption key may be incorrect. Error: " + e.message;
}
}
if (isMap(_r) && __JSONformat.unsafe) {
traverse(_r, (aK, aV, aP, aO) => { if (isString(aV) && aV.startsWith("!!js/eval ")) aO[aK] = eval(aV.slice(10)); });
Expand All @@ -918,7 +922,11 @@ OpenWrap.oJob.prototype.__loadFile = function(aFile, removeTodos, isInclude) {
var _r = $rest({ throwExceptions: true }).getBytes(url);
_r = String(Packages.openaf.AFCmdBase.afc.dbIP(_r));
if (isString(_r)) {
try { _r = JSON.parse(_r); } catch (e) { }
try {
_r = JSON.parse(_r);
} catch (e) {
throw "Failed to parse encrypted JSON from URL '" + url + "'. The content may not be properly encrypted or the decryption key may be incorrect. Error: " + e.message;
}
}
if (isMap(_r) && __JSONformat.unsafe) {
traverse(_r, (aK, aV, aP, aO) => { if (isString(aV) && aV.startsWith("!!js/eval ")) aO[aK] = eval(aV.slice(10)); });
Expand All @@ -929,7 +937,12 @@ OpenWrap.oJob.prototype.__loadFile = function(aFile, removeTodos, isInclude) {
var fnReadEncYAML = f => {
var content = io.readFileBytes(f);
content = String(Packages.openaf.AFCmdBase.afc.dbIP(content));
var _r = af.fromYAML(content, true);
var _r;
try {
_r = af.fromYAML(content, true);
} catch (e) {
throw "Failed to parse encrypted YAML file '" + f + "'. The file may not be properly encrypted or the decryption key may be incorrect. Error: " + e.message;
}
if (isMap(_r) && __JSONformat.unsafe) {
traverse(_r, (aK, aV, aP, aO) => { if (isString(aV) && aV.startsWith("!!js/eval ")) aO[aK] = eval(aV.slice(10)); });
}
Expand All @@ -938,7 +951,12 @@ OpenWrap.oJob.prototype.__loadFile = function(aFile, removeTodos, isInclude) {
var fnReadEncJSON = f => {
var content = io.readFileBytes(f);
content = String(Packages.openaf.AFCmdBase.afc.dbIP(content));
var _r = JSON.parse(content);
var _r;
try {
_r = JSON.parse(content);
} catch (e) {
throw "Failed to parse encrypted JSON file '" + f + "'. The file may not be properly encrypted or the decryption key may be incorrect. Error: " + e.message;
}
if (isMap(_r) && __JSONformat.unsafe) {
traverse(_r, (aK, aV, aP, aO) => { if (isString(aV) && aV.startsWith("!!js/eval ")) aO[aK] = eval(aV.slice(10)); });
}
Expand Down