From 29f3e081b35e00c4d4157fd319a718672625149c Mon Sep 17 00:00:00 2001 From: bourgeoa Date: Mon, 4 Nov 2024 17:05:00 +0100 Subject: [PATCH] rewrite create container to keep req --- lib/ldp.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ldp.js b/lib/ldp.js index 5b5a729c..c1647956 100644 --- a/lib/ldp.js +++ b/lib/ldp.js @@ -242,12 +242,15 @@ class LDP { if (isOverQuota) { throw error(413, 'User has exceeded their storage quota') } - // Set url using folder/.meta. This is Hack to find folder path - const { path } = await this.resourceMapper.mapUrlToFile({ - url: container ? (url.url || url) + suffixMeta : url, + // Set url using folder/.meta + let { path } = await this.resourceMapper.mapUrlToFile({ + url, contentType, - createIfNotExists: true + createIfNotExists: true, + searchIndex: false }) + + if (container) { path += suffixMeta } // debug.handlers(container + ' item ' + (url.url || url) + ' ' + contentType + ' ' + path) // check if file exists, and in that case that it has the same extension if (!container) { await this.checkFileExtension(url, path) } @@ -260,7 +263,6 @@ class LDP { // clearAclCache() } // Directory created, now write the file - if (container) return return withLock(path, () => new Promise((resolve, reject) => { // HACK: the middleware in webid-oidc.js uses body-parser, thus ending the stream of data // for JSON bodies. So, the stream needs to be reset