From f5a8615f5ceac9d2b580a102212ac1e0806bfe24 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Wed, 22 May 2019 10:47:23 -0400 Subject: [PATCH] Fix bug where iD could add empty source tag to changeset (close #6405) --- modules/ui/commit.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/modules/ui/commit.js b/modules/ui/commit.js index 6880a5258..f0ad66004 100644 --- a/modules/ui/commit.js +++ b/modules/ui/commit.js @@ -86,22 +86,23 @@ export function uiCommit(context) { if (source) { tags.source = source; } - var existingSources = (tags.source || '').split(';'); - // add the photo overlays used during editing as sources var photoOverlaysUsed = context.history().photoOverlaysUsed(); if (photoOverlaysUsed.length) { + var sources = (tags.source || '').split(';'); + // include this tag for any photo layer - if (existingSources.indexOf('streetlevel imagery') === -1) { - existingSources.push('streetlevel imagery'); + if (sources.indexOf('streetlevel imagery') === -1) { + sources.push('streetlevel imagery'); } - } - photoOverlaysUsed.forEach(function(photoOverlay) { - if (existingSources.indexOf(photoOverlay) === -1) { - existingSources.push(photoOverlay); - } - }); - if (existingSources.length) { - tags.source = existingSources.join(';').substr(0, 255); + + // add the photo overlays used during editing as sources + photoOverlaysUsed.forEach(function(photoOverlay) { + if (sources.indexOf(photoOverlay) === -1) { + sources.push(photoOverlay); + } + }); + + tags.source = sources.join(';').substr(0, 255); } _changeset = new osmChangeset({ tags: tags });