@oino-ts/blob-azure 1.0.5 → 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.
@@ -174,8 +174,7 @@ class OINOBlobAzure extends blob_1.OINOBlob {
174
174
  throw new Error("OINOBlobAzure: not connected");
175
175
  }
176
176
  const blockBlobClient = this._containerClient.getBlockBlobClient(name);
177
- const headers = { blobDataType: contentType };
178
- await blockBlobClient.upload(content, content.length, { blobHTTPHeaders: headers });
177
+ await blockBlobClient.upload(content, content.length, { blobHTTPHeaders: { blobContentType: contentType } });
179
178
  }
180
179
  /**
181
180
  * Delete a named blob.
@@ -171,8 +171,7 @@ export class OINOBlobAzure extends OINOBlob {
171
171
  throw new Error("OINOBlobAzure: not connected");
172
172
  }
173
173
  const blockBlobClient = this._containerClient.getBlockBlobClient(name);
174
- const headers = { blobDataType: contentType };
175
- await blockBlobClient.upload(content, content.length, { blobHTTPHeaders: headers });
174
+ await blockBlobClient.upload(content, content.length, { blobHTTPHeaders: { blobContentType: contentType } });
176
175
  }
177
176
  /**
178
177
  * Delete a named blob.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oino-ts/blob-azure",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "OINO TS package for using Azure Blob Storage as a REST API.",
5
5
  "author": "Matias Kiviniemi (pragmatta)",
6
6
  "license": "MPL-2.0",
@@ -22,11 +22,11 @@
22
22
  "dependencies": {
23
23
  "@azure/storage-blob": "^12.0.0",
24
24
  "@azure/identity": "^3.0.0",
25
- "@oino-ts/blob": "1.0.5",
26
- "@oino-ts/common": "1.0.5"
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.5",
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"
@@ -42,6 +42,8 @@ import { OINOBlob, OINOBlobParams, OINOBlobDataModel, OINOBlobApi, type OINOBlob
42
42
  * })
43
43
  * ```
44
44
  */
45
+ const BLOB_AZURE_ILLEGAL_CHARS_REGEX = /[\x00-\x1f\x7f\\]/g
46
+
45
47
  export class OINOBlobAzure extends OINOBlob {
46
48
  private _containerClient: ContainerClient | null = null
47
49
 
@@ -52,6 +54,14 @@ export class OINOBlobAzure extends OINOBlob {
52
54
  }
53
55
  }
54
56
 
57
+ /**
58
+ * Replace characters that Azure Blob Storage does not permit in blob names
59
+ * (`\` and ASCII control characters) with `_`.
60
+ */
61
+ override sanitizeName(name: string): string {
62
+ return name.replace(BLOB_AZURE_ILLEGAL_CHARS_REGEX, "_")
63
+ }
64
+
55
65
  /**
56
66
  * Initialise the Azure SDK client. Does not perform any network call.
57
67
  */
@@ -193,8 +203,7 @@ export class OINOBlobAzure extends OINOBlob {
193
203
  throw new Error("OINOBlobAzure: not connected")
194
204
  }
195
205
  const blockBlobClient = this._containerClient.getBlockBlobClient(name)
196
- const headers:any = { blobDataType: contentType }
197
- await blockBlobClient.upload(content, content.length, { blobHTTPHeaders: headers })
206
+ await blockBlobClient.upload(content, content.length, { blobHTTPHeaders: { blobContentType: contentType } })
198
207
  }
199
208
 
200
209
  /**