Skip to content

Commit

Permalink
fuzzy match: include image ext in query fuzzy matching (should fix we…
Browse files Browse the repository at this point in the history
…brecorder/replayweb.page#5)

range support check: even if response is 200 on initial fetch, check for 'Accept-Range: bytes' to determine range support (see: esmero/format_strawberryfield#81)
  • Loading branch information
ikreymer committed Jun 25, 2020
1 parent 67680dd commit dcfe853
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/sw.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/blockloaders.js
Expand Up @@ -40,7 +40,7 @@ class HttpRangeLoader
try {
response = await fetch(this.url, {headers, method: "HEAD"});
if (response.status === 200 || response.status == 206) {
this.canLoadOnDemand = (response.status === 206);
this.canLoadOnDemand = ((response.status === 206) || response.headers.get("Accept-Ranges") === "bytes");
this.isValid = true;
}
} catch(e) {
Expand All @@ -52,7 +52,7 @@ class HttpRangeLoader
abort = new AbortController();
const signal = abort.signal;
response = await fetch(this.url, {headers, signal});
this.canLoadOnDemand = (response.status === 206);
this.canLoadOnDemand = ((response.status === 206) || response.headers.get("Accept-Ranges") === "bytes");
this.isValid = (response.status === 206 || response.status === 200);
}

Expand Down
2 changes: 1 addition & 1 deletion src/fuzzymatcher.js
Expand Up @@ -26,7 +26,7 @@ const DEFAULT_RULES =
"replace": "$1"
},

{"match": /(\.(?:php|js|webm|mp4))\?.*/i,
{"match": /(\.(?:php|js|webm|mp4|gif|jpg|png|css))\?.*/i,
"replace": "$1"
},

Expand Down

0 comments on commit dcfe853

Please sign in to comment.