Skip to content

Commit fd9dd30

Browse files
Merge pull request #22 from Azure-Samples/georgewallace-patch-2
updated javascript image comparison
2 parents 525f6c1 + 609fef9 commit fd9dd30

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ImageResizeWebApp/ImageResizeWebApp/Views/Home/Index.cshtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@
127127
// check if images are equal to array
128128
console.log('currently in gallery:')
129129
console.log(gallery.list)
130-
var imageLinksEqual = _.isEqual(_.sortBy(gallery.list), _.sortBy(fetchedImageLinks))
130+
var imageLinksEqual = _.isEqual(_.sortBy(gallery.list.map(s => s.split("?")[0])), _.sortBy(fetchedImageLinks.map(s => s.split("?")[0])))
131131
if ( imageLinksEqual ) {
132132
console.log('images arr are equal')
133133
// do nothing
134134
} else {
135135
console.log('images arr are not equal')
136136
137-
// update gallery
138-
var newImageLinks = _.difference(fetchedImageLinks, gallery.list)
137+
// update gallery with new image urls. Only compare actual url without SAS token query string
138+
var newImageLinks = _.difference(fetchedImageLinks.map(s => s.split("?")[0]), gallery.list.map(s => s.split("?")[0]))
139139
140140
console.log('differene is: ')
141141
console.log(newImageLinks)
@@ -171,4 +171,4 @@
171171
});
172172
}
173173
};
174-
</script>
174+
</script>

0 commit comments

Comments
 (0)