Skip to content

Commit

Permalink
Merge pull request #1 from geekley/patch-1
Browse files Browse the repository at this point in the history
Fix GIF header detection for some servers
  • Loading branch information
0ui committed Feb 29, 2020
2 parents bd22e1b + 112f7fd commit 0992bd8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/scrubber.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ window.addEventListener('load', () => {
const h = new XMLHttpRequest();
h.open('GET', url);
h.setRequestHeader('Range', 'bytes=0-5');
h.onload = request => {
h.onload = () => {
const validHeaders = ['GIF87a', 'GIF89a'];
if (validHeaders.includes(request.target.response)) use(url);
if (validHeaders.includes(h.responseText.substr(0, 6))) use(url);
else ignore('bad header');
}
};
h.onerror = () => ignore('error loading');
h.send(null);
});
Expand Down

0 comments on commit 0992bd8

Please sign in to comment.