Skip to content

feat(replay): Update fflate to 0.8.2 #14867

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

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dev-packages/browser-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@
"axios": "1.7.7",
"babel-loader": "^8.2.2",
"html-webpack-plugin": "^5.5.0",
"pako": "^2.1.0",
"fflate": "0.8.2",
"webpack": "^5.95.0"
},
"devDependencies": {
"@types/glob": "8.0.0",
"@types/node": "^18.19.1",
"@types/pako": "^2.0.0",
"glob": "8.0.3"
},
"volta": {
Expand Down
15 changes: 12 additions & 3 deletions dev-packages/browser-integration-tests/utils/replayHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { fullSnapshotEvent, incrementalSnapshotEvent } from '@sentry-intern
import { EventType } from '@sentry-internal/rrweb';
import type { ReplayEventWithTime } from '@sentry/browser';
import type { Breadcrumb, Event, ReplayEvent, ReplayRecordingMode } from '@sentry/core';
import pako from 'pako';
import { decompressSync, strFromU8 } from 'fflate';

import { envelopeRequestParser } from './helpers';

Expand Down Expand Up @@ -406,9 +406,9 @@ export const replayEnvelopeParser = (request: Request | null): unknown[] => {
if (envelopeBytes[i] === 0x78 && envelopeBytes[i + 1] === 0x9c) {
try {
// We found a zlib-compressed payload - let's decompress it
const payload = envelopeBytes.slice(i);
const payload = (envelopeBytes as Buffer).subarray(i);
// now we return the decompressed payload as JSON
const decompressedPayload = pako.inflate(payload as unknown as Uint8Array, { to: 'string' });
const decompressedPayload = decompress(payload);
return JSON.parse(decompressedPayload);
} catch {
// Let's log that something went wrong
Expand Down Expand Up @@ -488,3 +488,12 @@ function getRequest(resOrReq: Request | Response): Request {
// @ts-expect-error we check this
return typeof resOrReq.request === 'function' ? (resOrReq as Response).request() : (resOrReq as Request);
}

/** Decompress a compressed data payload. */
function decompress(data: Uint8Array): string {
if (!(data instanceof Uint8Array)) {
throw new Error(`Data passed to decompress is not a Uint8Array: ${data}`);
}
const decompressed = decompressSync(data);
return strFromU8(decompressed);
}
2 changes: 1 addition & 1 deletion packages/replay-internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@sentry-internal/replay-worker": "8.45.0",
"@sentry-internal/rrweb": "2.31.0",
"@sentry-internal/rrweb-snapshot": "2.31.0",
"fflate": "^0.8.1",
"fflate": "0.8.2",
"jest-matcher-utils": "^29.0.0",
"jsdom-worker": "^0.2.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/replay-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"homepage": "https://docs.sentry.io/platforms/javascript/session-replay/",
"dependencies": {
"fflate": "0.8.1"
"fflate": "0.8.2"
},
"engines": {
"node": ">=18"
Expand Down
18 changes: 4 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10346,11 +10346,6 @@
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==

"@types/pako@^2.0.0":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@types/pako/-/pako-2.0.2.tgz#155edb098859d98dd598b805b27ec2bf96cc5354"
integrity sha512-AtTbzIwhvLMTEUPudP3hxUwNK50DoX3amfVJmmL7WQH5iF3Kfqs8pG1tStsewHqmh75ULmjjldKn/B70D6DNcQ==

"@types/parse-json@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
Expand Down Expand Up @@ -18722,10 +18717,10 @@ fdir@^6.3.0:
resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.3.0.tgz#fcca5a23ea20e767b15e081ee13b3e6488ee0bb0"
integrity sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ==

[email protected].1, fflate@^0.8.1:
version "0.8.1"
resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.8.1.tgz#1ed92270674d2ad3c73f077cd0acf26486dae6c9"
integrity sha512-/exOvEuc+/iaUm105QIiOt4LpBdMTWsXxqR0HDF35vx3fmaKzw7354gTilCh5rkzEt8WYyG//ku3h3nRmd7CHQ==
[email protected].2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.8.2.tgz#fc8631f5347812ad6028bbe4a2308b2792aa1dea"
integrity sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==

fflate@^0.4.4:
version "0.4.8"
Expand Down Expand Up @@ -26830,11 +26825,6 @@ pako@^1.0.3:
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==

pako@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86"
integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==

param-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/param-case/-/param-case-3.0.4.tgz#7d17fe4aa12bde34d4a77d91acfb6219caad01c5"
Expand Down
Loading