File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export async function isImageTransformationEnabled(tenantId: string) {
49
49
export function isValidKey ( key : string ) : boolean {
50
50
// only allow s3 safe characters and characters which require special handling for now
51
51
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html
52
- return key . length > 0 && / ^ ( \w | \/ | ! | - | \. | \* | ' | \( | \) | | & | \$ | @ | = | ; | : | \+ | , | \? ) * $ / . test ( key )
52
+ return key . length > 0 && / ^ [ \p { L } \p { N } \p { M } \/ ! . \- * ' ( ) & $ @ = ; : + , ? ] + \. [ \p { L } \p { N } \p { M } ] + $ / u . test ( key )
53
53
}
54
54
55
55
/**
Original file line number Diff line number Diff line change
1
+ import { isValidKey } from "@storage/limits"
2
+
3
+ describe ( "Testing limits" , ( ) => {
4
+ test ( "accept special characters as s3 object name" , ( ) => {
5
+ expect ( isValidKey ( "望舌诊病.pdf" ) ) . toBe ( true )
6
+ expect ( isValidKey ( "ÖÄÜ.jpg" ) ) . toBe ( true )
7
+ expect ( isValidKey ( "åäö.png" ) ) . toBe ( true )
8
+ } )
9
+ } )
You can’t perform that action at this time.
0 commit comments