@oino-ts/blob-aws 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oino-ts/blob-aws",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "OINO TS package for using AWS S3 (or S3-compatible) storage as a REST API.",
5
5
  "author": "Matias Kiviniemi (pragmatta)",
6
6
  "license": "MPL-2.0",
@@ -22,11 +22,11 @@
22
22
  "types": "./dist/types/index.d.ts",
23
23
  "dependencies": {
24
24
  "@aws-sdk/client-s3": "^3.0.0",
25
- "@oino-ts/blob": "1.0.4",
26
- "@oino-ts/common": "1.0.4"
25
+ "@oino-ts/blob": "1.0.6",
26
+ "@oino-ts/common": "1.0.6"
27
27
  },
28
28
  "devDependencies": {
29
- "@oino-ts/types": "1.0.4",
29
+ "@oino-ts/types": "1.0.6",
30
30
  "@types/bun": "^1.1.14",
31
31
  "@types/node": "^22.0.00",
32
32
  "typescript": "~5.9.0"
@@ -45,6 +45,8 @@ import { OINOBlob, OINOBlobParams, OINOBlobDataModel, OINOBlobApi, type OINOBlob
45
45
  * })
46
46
  * ```
47
47
  */
48
+ const BLOB_S3_UNSAFE_CHARS_REGEX = /[\x00-\x1f\x7f\\{}[\]^`|<>#%]/g
49
+
48
50
  export class OINOBlobAwsS3 extends OINOBlob {
49
51
  private _s3Client: S3Client | null = null
50
52
 
@@ -55,6 +57,15 @@ export class OINOBlobAwsS3 extends OINOBlob {
55
57
  }
56
58
  }
57
59
 
60
+ /**
61
+ * Replace characters that are unsafe in S3 object key names
62
+ * (`\`, control characters, and shell/URL-special characters
63
+ * `{`, `}`, `[`, `]`, `^`, `` ` ``, `|`, `<`, `>`, `#`, `%`) with `_`.
64
+ */
65
+ override sanitizeName(name: string): string {
66
+ return name.replace(BLOB_S3_UNSAFE_CHARS_REGEX, "_")
67
+ }
68
+
58
69
  /**
59
70
  * Initialise the AWS SDK S3 client from the JSON-encoded `connectionStr`.
60
71
  * Does not perform any network call.