Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSA: Relax file name checks in the BucketFS #39755

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions fs/resources/test-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ const LOCK_ACCESS = {
};

// Array of separators used to separate components in hierarchical paths.
let kPathSeparators;
if (navigator.userAgent.includes('Windows NT')) {
// Windows uses both '/' and '\' as path separators.
kPathSeparators = ['/', '\\'];
} else {
kPathSeparators = ['/'];
}
// Consider both '/' and '\' as path separators to ensure file names are
// platform-agnostic.
let kPathSeparators = ['/', '\\'];

async function getFileSize(handle) {
const file = await handle.getFile();
Expand Down
14 changes: 2 additions & 12 deletions fs/script-tests/FileSystemFileHandle-move.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,15 @@ directory_test(async (t, root) => {
assert_array_equals(await getSortedDirectoryEntries(root), ['file-1']);
}, 'move(name) can be called multiple times');

directory_test(async (t, root) => {
const dir = await root.getDirectoryHandle('dir', {create: true});
const handle = await createFileWithContents(t, 'file-before', 'foo', dir);
await promise_rejects_js(t, TypeError, handle.move('Lorem.'));

assert_array_equals(await getSortedDirectoryEntries(root), ['dir/']);
assert_array_equals(await getSortedDirectoryEntries(dir), ['file-before']);
assert_equals(await getFileContents(handle), 'foo');
assert_equals(await getFileSize(handle), 3);
}, 'move(name) with a name with a trailing period should fail');

directory_test(async (t, root) => {
const handle = await createFileWithContents(t, 'file-before', 'foo', root);
await promise_rejects_js(t, TypeError, handle.move('test/test'));
await promise_rejects_js(t, TypeError, handle.move('test\\test'));

assert_array_equals(await getSortedDirectoryEntries(root), ['file-before']);
assert_equals(await getFileContents(handle), 'foo');
assert_equals(await getFileSize(handle), 3);
}, 'move(name) with a name with invalid characters should fail');
}, 'move(name) with a name with path separators should fail');

directory_test(async (t, root) => {
const handle = await createFileWithContents(t, 'file-before', 'abc', root);
Expand Down