Skip to content

Commit

Permalink
replay fixes:
Browse files Browse the repository at this point in the history
- ensure <base> URL is always unrewritten, if already rewritten
- don't force 'content-disposition: inline' for 'applicaton/' mime types
  • Loading branch information
ikreymer committed Dec 21, 2024
1 parent e9a15d2 commit 4eee5be
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webrecorder/wabac",
"version": "2.20.7",
"version": "2.20.8",
"main": "index.js",
"type": "module",
"exports": {
Expand Down Expand Up @@ -38,7 +38,7 @@
"path-parser": "^6.1.0",
"process": "^0.11.10",
"stream-browserify": "^3.0.0",
"warcio": "^2.4.2"
"warcio": "^2.4.3"
},
"devDependencies": {
"@swc-node/register": "^1.10.9",
Expand Down
5 changes: 4 additions & 1 deletion src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,11 @@ export class Collection {
response.setRange(range);
}

const ct = response.headers.get("content-type");

const deleteDisposition =
request.destination === "iframe" || request.destination === "document";
!ct?.startsWith("application/") &&
(request.destination === "iframe" || request.destination === "document");
return response.makeResponse(this.coHeaders, deleteDisposition);
}

Expand Down
7 changes: 7 additions & 0 deletions src/rewrite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,13 @@ export class Rewriter {
// set internal base to full url
this.baseUrl = new URL(url, this.baseUrl).href;

if (this.baseUrl.startsWith(self.location.origin)) {
const inx = this.baseUrl.indexOf("/http");
if (inx >= 0) {
this.baseUrl = this.baseUrl.slice(inx + 1);
}
}

// not an absolute url, ensure it has slash
if (url && this.baseUrl != url) {
try {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3764,10 +3764,10 @@ warcio@^2.4.0:
uuid-random "^1.3.2"
yargs "^17.7.2"

warcio@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/warcio/-/warcio-2.4.2.tgz#782d8dcb0769f271b0ae96521fb4969e2570e9b3"
integrity sha512-QYbZ3EGYtnAIrzL7Bajo7ak87pipilpkIfaFIzFQWUX4wuXNuKqnfQy/EAoi2tEIl3VJgsWcL+wjjk4+15MKbQ==
warcio@^2.4.3:
version "2.4.3"
resolved "https://registry.yarnpkg.com/warcio/-/warcio-2.4.3.tgz#37ff95c2358d0d5ddb16e924fe200c4774b3903d"
integrity sha512-c397HNfLE7yJsyVF3XKXB+Yh3q3WKljhdYRPkKF9eyZMtB+HIxj1aBqgq0nTYz492KMKtzygBo0Gx+Gi0fJ9dg==
dependencies:
"@types/pako" "^1.0.7"
"@types/stream-buffers" "^3.0.7"
Expand Down

0 comments on commit 4eee5be

Please sign in to comment.