Skip to content

🎥 Make videos programmatically with React

Filename check for OSX

Patric Salvisberg5d7e1b9e5728
diff --git a/packages/cli/src/editor/components/RenderModal/RenderModalInput.tsx b/packages/cli/src/editor/components/RenderModal/RenderModalInput.tsx
index ea092cd874..f1c2745e77 100644
--- a/packages/cli/src/editor/components/RenderModal/RenderModalInput.tsx
+++ b/packages/cli/src/editor/components/RenderModal/RenderModalInput.tsx
@@ -15,6 +15,7 @@ export const RenderModalInput: React.FC<{
}> = ({existence, inputStyle, outName, onValueChange, codec, audioCodec}) => {
const checkInpuName = useMemo(() => {
const extension = outName.substring(outName.lastIndexOf('.') + 1);
+ const prefix = outName.substring(0, outName.lastIndexOf('.'));
console.log('extension: ' + extension);
try {
BrowserSafeApis.validateOutputFilename({
@@ -25,9 +26,8 @@ export const RenderModalInput: React.FC<{
});
} catch (e) {
console.log(e);
- return (
- <ValidationMessage align="flex-end" message="Invalid file extension" />
- );
+ const errorMessage = 'Invalid file extension';
+ return <ValidationMessage align="flex-end" message={errorMessage} />;
}
if (existence) {
@@ -35,6 +35,19 @@ export const RenderModalInput: React.FC<{
<ValidationMessage align="flex-end" message="Will be overwritten" />
);
}
+
+ if (prefix.length < 1) {
+ return <ValidationMessage align="flex-end" message="Empty file name" />;
+ }
+
+ if (prefix[0] === '.') {
+ return (
+ <ValidationMessage
+ align="flex-end"
+ message="Filename starts with '.'"
+ />
+ );
+ }
}, [audioCodec, codec, existence, outName]);
return (