🎥 Make videos programmatically with React
better error message
Jonny Burgerf296aff3d14a
diff --git a/packages/core/src/static-file.ts b/packages/core/src/static-file.tsindex 671fd6eb3c..23e2b84270 100644--- a/packages/core/src/static-file.ts+++ b/packages/core/src/static-file.ts@@ -61,8 +61,10 @@ const trimLeadingSlash = (path: string): string => {const inner = (path: string): string => {if (typeof window !== 'undefined' && window.remotion_staticBase) {- if (path.includes(window.remotion_staticBase)) {- throw new Error("You can't nest staticFile() inside of staticFile()");+ if (path.startsWith(window.remotion_staticBase)) {+ throw new Error(+ `The value "${path}" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.`+ );}return `${window.remotion_staticBase}/${trimLeadingSlash(path)}`;diff --git a/packages/core/src/test/static-file-errors.test.ts b/packages/core/src/test/static-file-errors.test.tsindex d9d42a8433..bf3a79c593 100644--- a/packages/core/src/test/static-file-errors.test.ts+++ b/packages/core/src/test/static-file-errors.test.ts@@ -7,7 +7,7 @@ test('duplicate staticFile() should throw a warning', () => {remotion_staticBase: '/static-abcdef',};expect(() => staticFile(staticFile('file.mp3'))).toThrow(- "You can't nest staticFile() inside of staticFile()"+ 'The value "/static-abcdef/file.mp3" is already prefixed with the static base /static-abcdef. You don\'t need to call staticFile() on it.');});