| 353 | assert.strictEqual(typeof objectMD, 'object'); |
| 354 | |
| 355 | function deleteMDandData() { |
| 356 | return metadata.deleteObjectMD(bucketName, objectKey, options, log, |
| 357 | (err, res) => { |
| 358 | if (err) { |
| 359 | return cb(err, res); |
| 360 | } |
| 361 | log.trace('deleteObject: metadata delete OK'); |
| 362 | if (objectMD.location === null) { |
| 363 | return cb(null, res); |
| 364 | } |
| 365 | |
| 366 | if (deferLocationDeletion) { |
| 367 | return cb(null, Array.isArray(objectMD.location) |
| 368 | ? objectMD.location : [objectMD.location]); |
| 369 | } |
| 370 | |
| 371 | if (!Array.isArray(objectMD.location)) { |
| 372 | data.delete(objectMD.location, log); |
| 373 | return cb(null, res); |
| 374 | } |
| 375 | |
| 376 | return data.batchDelete(objectMD.location, null, null, log, err => { |
| 377 | if (err) { |
| 378 | return cb(err); |
| 379 | } |
| 380 | return cb(null, res); |
| 381 | }); |
| 382 | }, originOp); |
| 383 | } |
| 384 | |
| 385 | const objGetInfo = objectMD.location; |
| 386 | // special case that prevents azure blocks from unecessary deletion |