Skip to content

Commit ff2fa09

Browse files
committed
Refactor Azure Blob Storage client initialization and add cleanup functionality for Azure Blob objects
1 parent 4409e58 commit ff2fa09

File tree

2 files changed

+386
-367
lines changed

2 files changed

+386
-367
lines changed

lib/azure-blob-storage.js

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module.exports = class AzureAttachmentsService extends require("./basic") {
5858
})
5959

6060
this.containerName = creds.container_name
61-
this.blobServiceClient = new BlobServiceClient(creds.container_uri + "?" + creds.sas_token)
61+
this.blobServiceClient = new BlobServiceClient(`${creds.container_uri}?${creds.sas_token}`)
6262
this.containerClient = this.blobServiceClient.getContainerClient(creds.container_name)
6363

6464
logConfig.info('Azure Blob Storage client initialized successfully', {
@@ -437,35 +437,6 @@ module.exports = class AzureAttachmentsService extends require("./basic") {
437437
}
438438
}
439439

440-
/**
441-
* @inheritdoc
442-
*/
443-
registerDraftUpdateHandlers(srv, entity, mediaElements) {
444-
for (const mediaElement of mediaElements) {
445-
srv.prepend(() => {
446-
if (mediaElement.drafts) {
447-
srv.on(
448-
"PUT",
449-
mediaElement.drafts,
450-
this.updateContentHandler.bind(this)
451-
)
452-
453-
// case: attachments uploaded in draft and deleted before saving
454-
srv.before(
455-
"DELETE",
456-
mediaElement.drafts,
457-
this.attachDraftDeletionData.bind(this)
458-
)
459-
srv.after(
460-
"DELETE",
461-
mediaElement.drafts,
462-
this.deleteAttachmentsWithKeys.bind(this)
463-
)
464-
}
465-
})
466-
}
467-
}
468-
469440
/**
470441
* Deletes a file from Azure Blob Storage
471442
* @param {string} Key - The key of the file to delete

0 commit comments

Comments
 (0)