MCPcopy Index your code
hub / github.com/scality/cloudserver / objectDeleteTagging

Function objectDeleteTagging

lib/api/objectDeleteTagging.js:25–120  ·  view source on GitHub ↗

* Object Delete Tagging - Delete tag set from an object * @param {AuthInfo} authInfo - Instance of AuthInfo class with requester's info * @param {object} request - http request object * @param {object} log - Werelogs logger * @param {function} callback - callback to server * @return {undefined}

(authInfo, request, log, callback)

Source from the content-addressed store, hash-verified

23 * @return {undefined}
24 */
25function objectDeleteTagging(authInfo, request, log, callback) {
26 log.debug('processing request', { method: 'objectDeleteTagging' });
27
28 const bucketName = request.bucketName;
29 const objectKey = request.objectKey;
30
31 const decodedVidResult = decodeVersionId(request.query);
32 if (decodedVidResult instanceof Error) {
33 log.trace('invalid versionId query', {
34 versionId: request.query.versionId,
35 error: decodedVidResult,
36 });
37 return process.nextTick(() => callback(decodedVidResult));
38 }
39 const reqVersionId = decodedVidResult;
40
41 const metadataValParams = {
42 authInfo,
43 bucketName,
44 objectKey,
45 versionId: reqVersionId,
46 getDeleteMarker: true,
47 requestType: request.apiMethods || 'objectDeleteTagging',
48 request,
49 };
50
51 return async.waterfall([
52 next => standardMetadataValidateBucketAndObj(metadataValParams, request.actionImplicitDenies, log,
53 (err, bucket, objectMD) => {
54 if (err) {
55 log.trace('request authorization failed',
56 { method: 'objectDeleteTagging', error: err });
57 return next(err);
58 }
59 if (!objectMD) {
60 const err = reqVersionId ? errors.NoSuchVersion :
61 errors.NoSuchKey;
62 log.trace('error no object metadata found',
63 { method: 'objectDeleteTagging', error: err });
64 return next(err, bucket);
65 }
66 if (objectMD.isDeleteMarker) {
67 log.trace('version is a delete marker',
68 { method: 'objectDeleteTagging' });
69 // FIXME we should return a `x-amz-delete-marker: true` header,
70 // see S3C-7592
71 return next(errors.MethodNotAllowed, bucket);
72 }
73 return next(null, bucket, objectMD);
74 }),
75 (bucket, objectMD, next) => {
76 // eslint-disable-next-line no-param-reassign
77 objectMD.tags = {};
78 const params = getVersionSpecificMetadataOptions(objectMD, config.nullVersionCompatMode);
79 const replicationInfo = getReplicationInfo(config,
80 objectKey, bucket, true, 0, REPLICATION_ACTION, objectMD);
81 if (replicationInfo) {
82 // eslint-disable-next-line no-param-reassign

Callers 2

Calls 9

getReplicationInfoFunction · 0.85
collectCorsHeadersFunction · 0.85
pushMetricFunction · 0.85
getVersionIdResHeaderFunction · 0.85
debugMethod · 0.80
traceMethod · 0.80
decodeVersionIdFunction · 0.50

Tested by

no test coverage detected