Skip to content

Commit

Permalink
fix: 🐛 do not allow empty children names
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Jun 17, 2023
1 parent 21bcbab commit 43da1d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ onlyOnNode20('NodeFileSystemDirectoryHandle', () => {
});

const invalidNames = [
'',
'.',
'..',
'/',
Expand Down Expand Up @@ -368,6 +369,7 @@ onlyOnNode20('NodeFileSystemDirectoryHandle', () => {
});

const invalidNames = [
'',
'.',
'..',
'/',
Expand Down
2 changes: 1 addition & 1 deletion src/node-to-fsa/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const basename = (path: string, separator: string) => {
const nameRegex = /^(\.{1,2})|(.*(\/|\\).*)$/;

export const assertName = (name: string, method: string, klass: string) => {
const isInvalid = nameRegex.test(name);
const isInvalid = !name || nameRegex.test(name);
if (isInvalid) throw new TypeError(`Failed to execute '${method}' on '${klass}': Name is not allowed.`);
};

Expand Down

0 comments on commit 43da1d6

Please sign in to comment.