Skip to content

Commit

Permalink
fix: ブラウザ版でファイル保存できない問題を解決 (#2494)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Jan 18, 2025
1 parent 14f9a3d commit f7f0cb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/backend/browser/fakePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { uuid4 } from "@/helpers/random";

const fakePathSchema = z
.string()
.regex(/^<browser-dummy-[0-9a-f]+>-.+$/)
.regex(/^<browser-dummy-[-0-9a-f]+>-.+$/)
.brand("FakePath");
export type FakePath = z.infer<typeof fakePathSchema>;

Expand Down
10 changes: 10 additions & 0 deletions tests/unit/backend/browser/fakePath.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { isFakePath, createFakePath } from "@/backend/browser/fakePath";

it.each([
"spaced file name",
"filename-with-extension.wav",
"日本語ファイル名",
])("FakePathを作れて検証もできる: %s", (input) => {
const fakePath = createFakePath(input);
expect(isFakePath(fakePath)).toBe(true);
});

0 comments on commit f7f0cb6

Please sign in to comment.