Commit d00f775c authored by Fred Chasen's avatar Fred Chasen

Merge branch 'file-status-code-0' into 'master'

Handle Chrome's 0 status code (when using the file protocol)

See merge request tools/pagedjs!43
parents 3934cc7a 12d34d07
......@@ -11,7 +11,9 @@ export default async function request(url, options={}) {
request.withCredentials = options.credentials=='include';
request.onload = () => {
resolve(new Response(request.responseText, {status: request.status}));
// Chrome returns a status code of 0 for local files
const status = request.status === 0 && url.startsWith('file://') ? 200 : request.status;
resolve(new Response(request.responseText, {status}));
};
request.onerror = reject;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment