Skip to content

Commit 432c0d4

Browse files
Merge pull request #592 from cloudinary/context-and-metadata-included-in-response-after-rename
feat: passing context and metadata when using rename
2 parents 5550e6f + 07a483f commit 432c0d4

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

lib-es5/uploader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ exports.rename = function rename(from_public_id, to_public_id, callback) {
269269
to_public_id: to_public_id,
270270
overwrite: options.overwrite,
271271
invalidate: options.invalidate,
272-
to_type: options.to_type
272+
to_type: options.to_type,
273+
context: options.context,
274+
metadata: options.metadata
273275
}];
274276
});
275277
};

lib/uploader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ exports.rename = function rename(from_public_id, to_public_id, callback, options
220220
to_public_id: to_public_id,
221221
overwrite: options.overwrite,
222222
invalidate: options.invalidate,
223-
to_type: options.to_type
223+
to_type: options.to_type,
224+
context: options.context,
225+
metadata: options.metadata
224226
}
225227
];
226228
});

test/integration/api/uploader/uploader_spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ describe("uploader", function () {
191191
expect(format).to.eql("png");
192192
});
193193
});
194+
it('should include tags in rename response if requested explicitly', async () => {
195+
const uploadResult = await cloudinary.v2.uploader.upload(IMAGE_FILE, { context: 'alt=Example|class=Example', tags: ['test-tag'] });
196+
197+
const renameResult = await cloudinary.v2.uploader.rename(uploadResult.public_id, `${uploadResult.public_id}-renamed`, {tags: true, context: true});
198+
199+
expect(renameResult).to.have.property('tags');
200+
expect(renameResult).to.have.property('context');
201+
});
194202
return context(":invalidate", function () {
195203
var spy, xhr;
196204
spy = void 0;

0 commit comments

Comments
 (0)