diff --git a/src/js/main.js b/src/js/main.js index bccca46..b6d7569 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1077,10 +1077,10 @@ require([ // Update the new item's tags to make it easier to trace its origins. var newTags = description.tags; - newTags.push("source-" + description.id); - destinationPortal.updateDescription(destinationPortal.username, service.itemId, folder, JSON.stringify({ - tags: newTags - })); + newTags.push("sourceId-" + description.id); + newTags.push("copied with ago-assistant"); + destinationPortal.updateDescription(destinationPortal.username, service.itemId, folder, JSON.stringify({tags: newTags})); + portal.serviceLayers(description.url) .then(function(definition) { var layerCount = definition.layers.length; diff --git a/src/js/portal/content/updateDescription.js b/src/js/portal/content/updateDescription.js index 324a7df..0ed150e 100644 --- a/src/js/portal/content/updateDescription.js +++ b/src/js/portal/content/updateDescription.js @@ -11,14 +11,15 @@ export function updateDescription(username, id, folder, description) { * This is necessary because some of the item descriptions (e.g. tags and extent) * are returned as arrays, but the POST operation expects comma separated strings. */ - for (let [key, value] of description) { + let payload = JSON.parse(description); + for (let key of Object.keys(payload)) { + let value = payload[key]; if (value === null) { - description[key] = ""; + payload[key] = ""; } else if (value instanceof Array) { - description[key] = value.toString(); + payload[key] = value.toString(); } } - let payload = JSON.parse(description); payload.token = portal.token; payload.f = "json"; let options = {