diff --git a/index.js b/index.js index 2ae14aa0d539c7b7f57c798b19ee28feb519b249..b2f8363bcc0649f7aae083509e0137297eee8ff1 100644 --- a/index.js +++ b/index.js @@ -181041,6 +181041,7 @@ const removeFile = async function (file) { module.exports = saveFiles; module.exports.getFileIfExists = getFileIfExists; +module.exports.sanitizeFileName = sanitizeFileName; function getFileName(entry) { let filename; @@ -181061,7 +181062,9 @@ function getFileName(entry) { } function sanitizeFileName(filename) { - return filename.replace(/^\.+$/, '').replace(/[/?<>\\:*|":]/g, ''); + return filename.replace(/^\.+$/, '').replace(/[/?<>\\:*|":]/g, '') // Replace ascii control characters from 00 to 0F + // eslint-disable-next-line no-control-regex + .replace(/[\x00-\x0F]/g, ''); } function checkFileSize(fileobject) { @@ -228063,10 +228066,12 @@ async function activateContract( return parseServiceId(parsedReply) } catch (error) { log('error', 'Error while activating contract: ' + error) - log( - 'error', - `Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}` - ) + if (parsedReply.Envelope.Body.Fault) { + log( + 'error', + `Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}` + ) + } //TODO: handle SGT4B8: Il existe déjà plusieurs demandes en cours sur le point ? throw errors.LOGIN_FAILED } @@ -228276,10 +228281,12 @@ async function verifyContract(url, apiAuthKey, appLogin, contractId, pointId) { return null } catch (error) { log('error', 'Error while parsing user contract: ' + error) - log( - 'error', - `Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}` - ) + if (parsedReply.Envelope.Body.Fault) { + log( + 'error', + `Enedis issue ${parsedReply.Envelope.Body.Fault.detail.erreur.resultat.$.code}: ${parsedReply.Envelope.Body.Fault.faultstring}` + ) + } throw errors.LOGIN_FAILED } } diff --git a/onDeleteAccount.js b/onDeleteAccount.js index f8992eba4334e6db2cbf2ee3f446cab12f106daf..78f89d5c5ad1b5a1392a889a350c51e68a17b1cf 100644 --- a/onDeleteAccount.js +++ b/onDeleteAccount.js @@ -180493,6 +180493,7 @@ const removeFile = async function (file) { module.exports = saveFiles; module.exports.getFileIfExists = getFileIfExists; +module.exports.sanitizeFileName = sanitizeFileName; function getFileName(entry) { let filename; @@ -180513,7 +180514,9 @@ function getFileName(entry) { } function sanitizeFileName(filename) { - return filename.replace(/^\.+$/, '').replace(/[/?<>\\:*|":]/g, ''); + return filename.replace(/^\.+$/, '').replace(/[/?<>\\:*|":]/g, '') // Replace ascii control characters from 00 to 0F + // eslint-disable-next-line no-control-regex + .replace(/[\x00-\x0F]/g, ''); } function checkFileSize(fileobject) {