From 41b64335539a02f26efd4d9150880baff909d56e Mon Sep 17 00:00:00 2001 From: Tommy Petty Date: Tue, 19 Dec 2023 14:31:56 -0500 Subject: [PATCH] fix(cli): uniquify temp directory used during dataset import --- packages/@sanity/import/src/importFromStream.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/@sanity/import/src/importFromStream.js b/packages/@sanity/import/src/importFromStream.js index 00a999b0b46..70018380100 100644 --- a/packages/@sanity/import/src/importFromStream.js +++ b/packages/@sanity/import/src/importFromStream.js @@ -13,7 +13,12 @@ const getJsonStreamer = require('./util/getJsonStreamer') module.exports = (stream, options, importers) => new Promise((resolve, reject) => { - const outputPath = path.join(os.tmpdir(), 'sanity-import') + const slugDate = new Date() + .toISOString() + .replace(/[^a-z0-9]/gi, '-') + .toLowerCase() + + const outputPath = path.join(os.tmpdir(), `sanity-import-${slugDate}`) debug('Importing from stream') let isTarStream = false