From 96ba5f10ca546fb6350c498c81ccccc287ae315b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 23 Jan 2016 23:29:21 -0800 Subject: [PATCH] Handle case of error response from archive. --- src/classes/Fetcher.coffee | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/classes/Fetcher.coffee b/src/classes/Fetcher.coffee index 297dcbb24..3866122e3 100644 --- a/src/classes/Fetcher.coffee +++ b/src/classes/Fetcher.coffee @@ -88,7 +88,7 @@ class Fetcher archive = Redirect.data.post[@boardID] if /^https:\/\//.test(url) or location.protocol is 'http:' $.cache url, (e) => - @parseArchivedPost e.target.response, url + @parseArchivedPost e.target.response, url, archive , responseType: 'json' withCredentials: archive.withCredentials @@ -100,17 +100,22 @@ class Fetcher # Image/thumbnail URLs loaded over HTTP can be modified in transit. # Require them to be from an HTTP host so that no referrer is sent to them from an HTTPS page. delete media[key] unless media[key]?.match /^http:\/\// - @parseArchivedPost response, url + @parseArchivedPost response, url, archive return true return false - parseArchivedPost: (data, url) -> + parseArchivedPost: (data, url, archive) -> # In case of multiple callbacks for the same request, # don't parse the same original post more than once. if post = g.posts["#{@boardID}.#{@postID}"] @insert post return + unless data? + $.addClass @root, 'warning' + @root.textContent = "Error fetching Post No.#{@postID} from #{archive.name}." + return + if data.error $.addClass @root, 'warning' @root.textContent = data.error