Skip to content

🎥 Make videos programmatically with React

fix non ascii characters in staticFile

Jonny Burger824ab84b4d46
diff --git a/packages/cli/src/preview-server/serve-static.ts b/packages/cli/src/preview-server/serve-static.ts
index 5e81c5c260..a8cea52f94 100644
--- a/packages/cli/src/preview-server/serve-static.ts
+++ b/packages/cli/src/preview-server/serve-static.ts
@@ -28,13 +28,11 @@ export const serveStatic = async function (
return;
}
- const path = join(
- root,
- new URL(req.url as string, 'http://localhost').pathname.replace(
- new RegExp(`^${hash}`),
- ''
- )
- );
+ const filename = new URL(
+ req.url as string,
+ 'http://localhost'
+ ).pathname.replace(new RegExp(`^${hash}`), '');
+ const path = join(root, decodeURIComponent(filename));
if (!RenderInternals.isPathInside(path, root)) {
res.writeHead(500);
diff --git a/packages/example/public/logo.png "b/packages/example/public/nested/log\303\266.png"
similarity index 100%
rename from packages/example/public/logo.png
rename to "packages/example/public/nested/log\303\266.png"
diff --git a/packages/example/src/StaticServer/index.tsx b/packages/example/src/StaticServer/index.tsx
index 48e4ad8f8c..5f836cdedf 100644
--- a/packages/example/src/StaticServer/index.tsx
+++ b/packages/example/src/StaticServer/index.tsx
@@ -8,7 +8,7 @@ export const StaticDemo: React.FC = () => {
return (
<>
<Img
- src={staticFile('logo.png')}
+ src={staticFile('nested/logö.png')}
onLoad={() => continueRender(handle1)}
/>
<Img