Compare commits

...

1 Commits

Author SHA1 Message Date
MelissaFrncJrg
ce497762d9 feat(fs): implement auto-detection of Azure WORM immutability 2026-05-12 15:30:30 +02:00

View File

@@ -18,6 +18,7 @@ export default class AzureHandler extends RemoteHandlerAbstract {
#dir
#blobServiceClient
#containerClient
#immutable = false
constructor(remote, _opts) {
super(remote, _opts)
@@ -86,9 +87,28 @@ export default class AzureHandler extends RemoteHandlerAbstract {
*/
async _sync() {
await this.#containerClient.createIfNotExists()
try {
const { hasImmutabilityPolicy, hasLegalHold } = await this.#containerClient.getProperties()
if (hasImmutabilityPolicy || hasLegalHold) {
info('Azure container has immutability policy, switching to immutable mode')
this.#immutable = true
}
} catch (error) {
if (error.statusCode === 403) {
// no privilege to read container properties — stay conservative, assume immutability
warn('Azure user lacks privilege to check immutability policy, assuming immutable')
this.#immutable = true
} else {
throw error
}
}
await super._sync()
}
isImmutable() {
return this.#immutable || super.isImmutable()
}
/**
* upload file from a stream
* @param {string} path destination file