Skip to content

🎥 Make videos programmatically with React

allow a slash in outName

Jonny Burgere0ad5651861b
diff --git a/packages/docs/docs/lambda/rendermediaonlambda.md b/packages/docs/docs/lambda/rendermediaonlambda.md
index a132f2d01d..c2a8b5ffb7 100644
--- a/packages/docs/docs/lambda/rendermediaonlambda.md
+++ b/packages/docs/docs/lambda/rendermediaonlambda.md
@@ -117,7 +117,7 @@ The file name of the media output.
It can either be:
-- `undefined` - it will default to `out` plus the appropriate file extension, for example: `renders/${renderId}/out.mp4`. The outName must match `/^([0-9a-zA-Z-!_.*'()]+)$/g`.
+- `undefined` - it will default to `out` plus the appropriate file extension, for example: `renders/${renderId}/out.mp4`. The outName must match `/^([0-9a-zA-Z-!_.*'()/]+)$/g`.
- A `string` - it will get saved to the same S3 bucket as your site under the key `renders/{renderId}/{outName}`.
- An object of shape `{ key: string; bucketName: string }`. This will save the render to an arbitrary bucket with an arbitrary key. Note the following restrictions:
- You must extend the default Remotion policy to allow read and write access to that bucket.
diff --git a/packages/docs/docs/lambda/renderstillonlambda.md b/packages/docs/docs/lambda/renderstillonlambda.md
index 79ecd6e1aa..4143935ad4 100644
--- a/packages/docs/docs/lambda/renderstillonlambda.md
+++ b/packages/docs/docs/lambda/renderstillonlambda.md
@@ -102,7 +102,7 @@ The file name of the media output.
It can either be:
-- `undefined` - it will default to `out` plus the appropriate file extension, for example: `renders/${renderId}/out.mp4`. The outName must match `/^([0-9a-zA-Z-!_.*'()]+)$/g`.
+- `undefined` - it will default to `out` plus the appropriate file extension, for example: `renders/${renderId}/out.mp4`. The outName must match `/^([0-9a-zA-Z-!_.*'()/]+)$/g`.
- A `string` - it will get saved to the same S3 bucket as your site under the key `renders/{renderId}/{outName}`.
- An object of shape `{ key: string; bucketName: string }`. This will save the render to an arbitrary bucket with an arbitrary key. Note the following restrictions:
- You must extend the default Remotion policy to allow read and write access to that bucket.
diff --git a/packages/lambda/src/shared/validate-outname.ts b/packages/lambda/src/shared/validate-outname.ts
index 363e9285d3..870224c34e 100644
--- a/packages/lambda/src/shared/validate-outname.ts
+++ b/packages/lambda/src/shared/validate-outname.ts
@@ -8,9 +8,9 @@ const validateS3Key = (s3Key: string) => {
);
}
- if (!s3Key.match(/^([0-9a-zA-Z-!_.*'()]+)$/g)) {
+ if (!s3Key.match(/^([0-9a-zA-Z-!_.*'()/]+)$/g)) {
throw new Error(
- "The S3 Key must match the RegExp `/([0-9a-zA-Z-!_.*'()]+)/g`. You passed: " +
+ "The S3 Key must match the RegExp `/([0-9a-zA-Z-!_.*'()/]+)/g`. You passed: " +
s3Key +
'. Check for invalid characters.'
);
diff --git a/packages/lambda/src/test/unit/expected-out-name.test.ts b/packages/lambda/src/test/unit/expected-out-name.test.ts
index 5358161461..0a97feeb5b 100644
--- a/packages/lambda/src/test/unit/expected-out-name.test.ts
+++ b/packages/lambda/src/test/unit/expected-out-name.test.ts
@@ -87,3 +87,13 @@ test('Should throw on invalid names', () => {
});
}, /The S3 Key must match the RegExp/);
});
+test('Should allow outName an outname with a slash', () => {
+ const newRenderMetadata: RenderMetadata = {
+ ...testRenderMetadata,
+ outName: 'justa/name.jpeg',
+ };
+ expect(getExpectedOutName(newRenderMetadata, bucketName)).toEqual({
+ key: 'renders/9n8dsfafs/justa/name.jpeg',
+ renderBucketName: 'remotionlambda-98fsduf',
+ });
+});