Skip to content
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

Fix: CLI dashboard showing multiple cookie entries for same cookies #597

Merged
merged 2 commits into from
Apr 11, 2024
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
2 changes: 1 addition & 1 deletion packages/cli/src/utils/browserManagement/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
this.shouldLogDebug = shouldLogDebug;
}

debugLog(msg: any) {

Check warning on line 57 in packages/cli/src/utils/browserManagement/index.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
if (this.shouldLogDebug) {
console.log(msg);
}
Expand Down Expand Up @@ -304,7 +304,7 @@
}
const frameIdMapFromTree = new Map();
const frames = page.frames();
const frameCallback = (frame: any) => {

Check warning on line 307 in packages/cli/src/utils/browserManagement/index.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const frameId = frame._id;
const _url = frame.url();
frameIdMapFromTree.set(frameId, _url);
Expand Down Expand Up @@ -365,7 +365,7 @@
requestMap,
frameIdUrlMap,
mainFrameId,
url
page.url()
);

const networkCookieKeySet = new Set();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,15 @@ export const parseNetworkDataToCookieData = (
data.responses?.forEach((response: ResponseData) => {
response.cookies.forEach((cookie) => {
// domain update required. Domain based on the server url
const parsedDomain =
let parsedDomain =
cookie.parsedCookie.domain === ''
? getDomain(response.serverUrl)
: cookie.parsedCookie.domain;

if (parsedDomain && parsedDomain[0] !== '.') {
parsedDomain = '.' + parsedDomain;
}

const key =
cookie.parsedCookie.name +
':' +
Expand Down Expand Up @@ -119,11 +123,15 @@ export const parseNetworkDataToCookieData = (
data.requests?.forEach((request: RequestData) => {
request.cookies.forEach((cookie) => {
// domain update required. Domain based on the server url
const parsedDomain =
let parsedDomain =
cookie.parsedCookie.domain === ''
? getDomain(request.serverUrl)
: cookie.parsedCookie.domain;

if (parsedDomain && parsedDomain[0] !== '.') {
parsedDomain = '.' + parsedDomain;
}

const key =
cookie.parsedCookie.name +
':' +
Expand All @@ -148,7 +156,7 @@ export const parseNetworkDataToCookieData = (
});

frameIdCookiesMap.set(frameId, {
frameUrl: frameIdUrlMap.get(frameId) || pageUrl,
frameUrl: frameIdUrlMap.get(frameId) || new URL(pageUrl).origin,
frameCookies: Object.fromEntries(_frameCookies),
});
}
Expand All @@ -166,6 +174,7 @@ export const parseNetworkDataToCookieData = (
if (!data.frameUrl.includes('http')) {
continue;
}

const _url = new URL(data.frameUrl);

const newFrameCookies = {
Expand Down
Loading