CreateBucketModal.utils.ts15 lines · main
| 1 | // [Joshen] These are referenced from the storage API directly here |
| 2 | // https://github.com/briven/storage/blob/69e4a40799a9d10be0a63a37cbb46d7d9bea0e17/src/storage/limits.ts#L59 |
| 3 | |
| 4 | // only allow s3 safe characters and characters which require special handling for now |
| 5 | // the slash restriction come from bucket naming rules |
| 6 | // and the rest of the validation rules are based on S3 object key validation. |
| 7 | // https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html |
| 8 | // https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html |
| 9 | export const validBucketNameRegex = /^(\w|!|-|\.|\*|'|\(|\)| |&|\$|@|=|;|:|\+|,|\?)*$/ |
| 10 | export const inverseValidBucketNameRegex = /[^A-Za-z0-9_!\-.*'() &$@=;:+,?]/ |
| 11 | |
| 12 | // only allow s3 safe characters and characters which require special handling for now |
| 13 | // https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html |
| 14 | export const validObjectKeyRegex = /^(\w|\/|!|-|\.|\*|'|\(|\)| |&|\$|@|=|;|:|\+|,|\?)*$/ |
| 15 | export const inverseValidObjectKeyRegex = /[^A-Za-z0-9_\/!\-.*'() &$@=;:+,?]/ |