From 7fe5382c4424f52fd08a6071e45c088a25032fd5 Mon Sep 17 00:00:00 2001
From: build-token <build-token>
Date: Mon, 22 Aug 2022 09:15:33 +0000
Subject: [PATCH] publish: Merge branch 'renovate/cozy-konnector-packages' into
 'main'

generated from commit 8487f77b74f420d38ae4dfcd474ab842e79e8f7c
---
 index.js           | 31 +++++--------------------------
 onDeleteAccount.js | 18 ++++--------------
 package.json       |  4 ++--
 3 files changed, 11 insertions(+), 42 deletions(-)

diff --git a/index.js b/index.js
index 58d1231..fad78c6 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) {
@@ -223577,18 +223580,6 @@ async function formateDataForDoctype(data) {
   })
 }
 
-/**
- * Check if response contains contracts
- * @param {string} parsedReply
- * @return {boolean}
- */
-function checkContractExists(parsedReply) {
-  const json = JSON.stringify(parsedReply)
-  return JSON.parse(json)['Envelope']['Body'][
-    'rechercherServicesSouscritsMesuresResponse'
-  ]['servicesSouscritsMesures']
-}
-
 /**
  * Format tag in order to be manipulated easly
  * @param {string} name
@@ -223624,7 +223615,6 @@ module.exports = {
   parseContracts,
   parseContractStartDate,
   parseServiceId,
-  checkContractExists,
 }
 
 
@@ -228214,12 +228204,7 @@ module.exports = { terminateContract }
 // @ts-check
 const { log, errors } = __webpack_require__(1)
 const soapRequest = __webpack_require__(1331)
-const {
-  parseTags,
-  parseValue,
-  parseContracts,
-  checkContractExists,
-} = __webpack_require__(1555)
+const { parseTags, parseValue, parseContracts } = __webpack_require__(1555)
 const { rechercherServicesSouscritsMesures } = __webpack_require__(1556)
 const xml2js = __webpack_require__(1513)
 const { contractState, contractLibelle } = __webpack_require__(1600)
@@ -228255,11 +228240,6 @@ async function verifyContract(url, apiAuthKey, appLogin, contractId, pointId) {
   })
 
   try {
-    if (!checkContractExists(parsedReply)) {
-      log('error', 'no contract found')
-      return null
-    }
-
     const currentContracts = parseContracts(parsedReply)
     let currentContract = null
     if (Array.isArray(currentContracts)) {
@@ -228267,7 +228247,6 @@ async function verifyContract(url, apiAuthKey, appLogin, contractId, pointId) {
     } else {
       currentContract = parseContracts(parsedReply)
     }
-    console.log(currentContract)
     if (
       (currentContract.etatCode === contractState.ACTIF ||
         currentContract.etatCode === contractState.DEMANDE) &&
diff --git a/onDeleteAccount.js b/onDeleteAccount.js
index f8992eb..08fe8dd 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) {
@@ -222918,18 +222921,6 @@ async function formateDataForDoctype(data) {
   })
 }
 
-/**
- * Check if response contains contracts
- * @param {string} parsedReply
- * @return {boolean}
- */
-function checkContractExists(parsedReply) {
-  const json = JSON.stringify(parsedReply)
-  return JSON.parse(json)['Envelope']['Body'][
-    'rechercherServicesSouscritsMesuresResponse'
-  ]['servicesSouscritsMesures']
-}
-
 /**
  * Format tag in order to be manipulated easly
  * @param {string} name
@@ -222965,7 +222956,6 @@ module.exports = {
   parseContracts,
   parseContractStartDate,
   parseServiceId,
-  checkContractExists,
 }
 
 
diff --git a/package.json b/package.json
index 54f2e54..f767edb 100644
--- a/package.json
+++ b/package.json
@@ -46,7 +46,7 @@
   },
   "dependencies": {
     "axios": "^0.27.2",
-    "cozy-konnector-libs": "4.54.0",
+    "cozy-konnector-libs": "4.55.0",
     "easy-soap-request": "^4.7.0",
     "jest": "^28.1.3",
     "moment": "^2.29.3",
@@ -54,7 +54,7 @@
     "xml2js": "^0.4.23"
   },
   "devDependencies": {
-    "cozy-jobs-cli": "1.18.2",
+    "cozy-jobs-cli": "1.19.1",
     "cozy-konnector-build": "1.3.4",
     "eslint-config-cozy-app": "1.3.3",
     "eslint-plugin-prettier": "^4.0.0",
-- 
GitLab