Handle case of error response from archive.
This commit is contained in:
parent
f32f0bb77d
commit
96ba5f10ca
@ -88,7 +88,7 @@ class Fetcher
|
|||||||
archive = Redirect.data.post[@boardID]
|
archive = Redirect.data.post[@boardID]
|
||||||
if /^https:\/\//.test(url) or location.protocol is 'http:'
|
if /^https:\/\//.test(url) or location.protocol is 'http:'
|
||||||
$.cache url, (e) =>
|
$.cache url, (e) =>
|
||||||
@parseArchivedPost e.target.response, url
|
@parseArchivedPost e.target.response, url, archive
|
||||||
,
|
,
|
||||||
responseType: 'json'
|
responseType: 'json'
|
||||||
withCredentials: archive.withCredentials
|
withCredentials: archive.withCredentials
|
||||||
@ -100,17 +100,22 @@ class Fetcher
|
|||||||
# Image/thumbnail URLs loaded over HTTP can be modified in transit.
|
# 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.
|
# 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:\/\//
|
delete media[key] unless media[key]?.match /^http:\/\//
|
||||||
@parseArchivedPost response, url
|
@parseArchivedPost response, url, archive
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
parseArchivedPost: (data, url) ->
|
parseArchivedPost: (data, url, archive) ->
|
||||||
# In case of multiple callbacks for the same request,
|
# In case of multiple callbacks for the same request,
|
||||||
# don't parse the same original post more than once.
|
# don't parse the same original post more than once.
|
||||||
if post = g.posts["#{@boardID}.#{@postID}"]
|
if post = g.posts["#{@boardID}.#{@postID}"]
|
||||||
@insert post
|
@insert post
|
||||||
return
|
return
|
||||||
|
|
||||||
|
unless data?
|
||||||
|
$.addClass @root, 'warning'
|
||||||
|
@root.textContent = "Error fetching Post No.#{@postID} from #{archive.name}."
|
||||||
|
return
|
||||||
|
|
||||||
if data.error
|
if data.error
|
||||||
$.addClass @root, 'warning'
|
$.addClass @root, 'warning'
|
||||||
@root.textContent = data.error
|
@root.textContent = data.error
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user