Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't return incomplete documents for HTTP.processDocuments #666

Open
wants to merge 3 commits into
base: 4.0
Choose a base branch
from

Conversation

aurimasv
Copy link
Contributor

@aurimasv aurimasv commented Mar 8, 2015

@adam3smith emailed me about an issue with Aleph translator. On https://aleph.univie.ac.at a ZU.processDocuments call to retrieve MARC metadata was returning an incomplete page (only a few META elements from the HEAD). The processDocuments call was accompanied by the following message in the Browser console:

The page was reloaded, because the character encoding declaration of the HTML document was not found when prescanning the first 1024 bytes of the file. The encoding declaration needs to be moved to be within the first 1024 bytes of the file.

So, what was happening was that the page was being loaded, the loading was stopped (firing a pageshow event, but not the load event), and Zotero was returning the incomplete document to translator (just past the META element with charset declaration).

This patch takes advantage to the load event not being fired in these cases to detect incomplete page loads. However, as commented here the same behavior is obtained for network errors (don't think these were being handled anyway), so we introduce some additional checks for those cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants