Skip to content

Commit

Permalink
Merge pull request #266 from capdragon/carlos
Browse files Browse the repository at this point in the history
Allow update of nested json object in description
  • Loading branch information
slibby committed Apr 22, 2020
2 parents 56caa19 + 7ce6a74 commit e212cc3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/js/portal/content/updateDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export function updateDescription(username, id, folder, description) {
* Clean up description items for posting.
* 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.
* Also, some attributes such as properties contain a JSON object which need to be
* stringified for the POST operation.
*/
let payload = JSON.parse(description);
for (let key of Object.keys(payload)) {
Expand All @@ -18,6 +20,8 @@ export function updateDescription(username, id, folder, description) {
payload[key] = "";
} else if (value instanceof Array) {
payload[key] = value.toString();
} else if (value instanceof Object) {
payload[key] = JSON.stringify(value);
}
}
payload.token = portal.token;
Expand Down

0 comments on commit e212cc3

Please sign in to comment.