From 30cebec32a1b15b0dd57d6072dda78e35026083a Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Thu, 11 Feb 2021 14:14:09 +0100 Subject: [PATCH] fix: Make mkdir recursive in FileDataAccessor DataAccessorBasedStore already did the checks to make sure writing this container is valid and this allows us to start the server in nested non-existing folders. --- src/storage/accessors/FileDataAccessor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/accessors/FileDataAccessor.ts b/src/storage/accessors/FileDataAccessor.ts index 0c38069c5..418461b5e 100644 --- a/src/storage/accessors/FileDataAccessor.ts +++ b/src/storage/accessors/FileDataAccessor.ts @@ -103,7 +103,7 @@ export class FileDataAccessor implements DataAccessor { public async writeContainer(identifier: ResourceIdentifier, metadata: RepresentationMetadata): Promise { const link = await this.resourceMapper.mapUrlToFilePath(identifier); try { - await fsPromises.mkdir(link.filePath); + await fsPromises.mkdir(link.filePath, { recursive: true }); } catch (error: unknown) { // Don't throw if directory already exists if (!isSystemError(error) || error.code !== 'EEXIST') {