diff --git a/nextcloud-upload/run.js b/nextcloud-upload/run.js index bbc39d4..b7730b0 100644 --- a/nextcloud-upload/run.js +++ b/nextcloud-upload/run.js @@ -50,7 +50,7 @@ async function upload() { }); if (response.status != 404) { let data = JSON.parse(xml.toJson(response.data)); - let dirs = data["d:multistatus"]["d:response"]?.slice(1) || []; + let dirs = data["d:multistatus"]["d:response"]?.slice?.(1) || []; // sort directories by last modified dirs.sort((a, b) => new Date(a["d:propstat"]["d:prop"]["d:getlastmodified"]) - new Date(b["d:propstat"]["d:prop"]["d:getlastmodified"])); while (dirs.length >= parseInt(retentionAmount)) {