Skip to content

The open source AI video agent: turns any coding agent into a video agent, with an editor to change anything it makes.

Studio: files imported together into a new folder all land (#75)

riverisbuilding6a82e7987cd7
diff --git a/.changeset/concurrent-import-folder.md b/.changeset/concurrent-import-folder.md
new file mode 100644
index 0000000..e805a01
--- /dev/null
+++ b/.changeset/concurrent-import-folder.md
@@ -0,0 +1,5 @@
+---
+'openfilm': patch
+---
+
+Studio: files imported together into a folder that is not there yet all land. One of them could be refused as "not a path inside the project" when another import made the folder at the same moment.
diff --git a/packages/openfilm/studio/server/files.mjs b/packages/openfilm/studio/server/files.mjs
index 0cb5145..ad9ba4b 100644
--- a/packages/openfilm/studio/server/files.mjs
+++ b/packages/openfilm/studio/server/files.mjs
@@ -104,11 +104,15 @@ function onDiskInside(/** @type {string} */ root, /** @type {string} */ abs) {
try { real = realpathSync.native(at); } catch {
let there = null;
try { there = lstatSync(at, { throwIfNoEntry: false }); } catch { /* a file on the way (ENOTDIR): not there */ }
- if (there) return false;
- const up = dirname(at);
- if (up === at) return false;
- at = up;
- continue;
+ if (there) {
+ /* made just now (an import beside this one makes its folder), or a link that leads nowhere: look once more */
+ try { real = realpathSync.native(at); } catch { return false; }
+ } else {
+ const up = dirname(at);
+ if (up === at) return false;
+ at = up;
+ continue;
+ }
}
const back = relative(home, real);
if (!back) return true;