diff --git a/src/Images/Gallery.coffee b/src/Images/Gallery.coffee index 9c069be2b..9e34d23a8 100644 --- a/src/Images/Gallery.coffee +++ b/src/Images/Gallery.coffee @@ -184,6 +184,7 @@ Gallery = if file.error?.code is MediaError.MEDIA_ERR_DECODE return new Notice 'error', 'Corrupt or unplayable video', 30 ImageCommon.error g.posts[file.dataset.post], null, -> + return unless URL thumb.href = URL file.src = URL if Gallery.nodes.current is file diff --git a/src/Images/ImageCommon.coffee b/src/Images/ImageCommon.coffee index 542fcfa41..c4a4eafc7 100644 --- a/src/Images/ImageCommon.coffee +++ b/src/Images/ImageCommon.coffee @@ -42,6 +42,7 @@ ImageCommon = filename: post.file.URL if URL and (/^https:\/\//.test(URL) or location.protocol is 'http:') return cb URL + cb null # report nothing to retry addControls: (video) -> handler = -> diff --git a/src/Images/ImageExpand.coffee b/src/Images/ImageExpand.coffee index a649010d9..43f59ca6d 100755 --- a/src/Images/ImageExpand.coffee +++ b/src/Images/ImageExpand.coffee @@ -218,15 +218,18 @@ ImageExpand = post = Get.postFromNode @ $.rm @ delete post.file.fullImage + if ImageCommon.decodeError @, post + ImageExpand.contract post + return # Images can error: # - before the image started loading. # - after the image started loading. - unless post.file.isExpanding or post.file.isExpanded - # Don't try to re-expand if it was already contracted. - return - ImageExpand.contract post - return if ImageCommon.decodeError @, post - ImageCommon.error post, 10 * $.SECOND, (URL) -> ImageExpand.expand post, URL + # Don't try to re-expand if it was already contracted. + if post.file.isExpanding or post.file.isExpanded + ImageCommon.error post, 10 * $.SECOND, (URL) -> + if post.file.isExpanding or post.file.isExpanded + ImageExpand.contract post + ImageExpand.expand post, URL if URL menu: init: -> diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index 4f1b3d22f..4c5e0cff5 100755 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -44,4 +44,5 @@ ImageHover = return unless doc.contains @ post = g.posts[@dataset.fullID] return if ImageCommon.decodeError @, post - ImageCommon.error post, 3 * $.SECOND, @src = URL + ImageCommon.error post, 3 * $.SECOND, -> + @src = URL if URL