Skip to content

Conversation

@adamziel
Copy link
Collaborator

@adamziel adamziel commented Nov 30, 2025

Summary

The Blueprint Editor was crashing when loading blueprints via URL that have bundled resources at the root level (e.g., ./piel.zip/piel.zip). The root cause was that fileExists() in both InMemoryFilesystemBackend and OpfsFilesystemBackend only returned true for files, not directories.

When the code tried to check if the parent directory / exists before creating it, fileExists('/') incorrectly returned false, causing the code to attempt mkdir('/') which threw "Invalid path: /".

This PR fixes fileExists() to behave as a general "path exists" check, returning true for both files and directories. The root directory now correctly returns true as well.

Test plan

The fileExists() method in InMemoryFilesystemBackend and OpfsFilesystemBackend
was incorrectly returning false for directories, only checking for files.
This caused the Blueprint Editor to crash when loading blueprints with
bundled resources at the root level (e.g., ./piel.zip), because the code
tried to mkdir('/') after fileExists('/') returned false.

This change makes fileExists() behave as a general "path exists" check,
returning true for both files and directories. The root directory now
correctly returns true as well.

Also adds comprehensive unit tests for InMemoryFilesystemBackend to
document and verify the expected filesystem semantics.
});

it('should return true for nested directories', async () => {
await backend.mkdir('/parent/child');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll adjust it in a follow up PR to require an explicit recursive option

@adamziel adamziel merged commit 137a8a0 into trunk Nov 30, 2025
32 checks passed
@adamziel adamziel deleted the fix-filesystem-file-exists branch November 30, 2025 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants