Skip to content

Fix 'trusted-set-cookie-reload' — website is not reloaded if '$now$' value is used #291

Closed
@AdamWr

Description

@AdamWr

It seems that website is not reloaded if rule like this:

example.org#%#//scriptlet('trusted-set-cookie-reload', 'cmpconsent', '$now$')

is used.

Probably the problem is with value === cookieValue here:

export const isCookieSetWithValue = (cookieString, name, value) => {
return cookieString.split(';')
.some((cookieStr) => {
const pos = cookieStr.indexOf('=');
if (pos === -1) {
return false;
}
const cookieName = cookieStr.slice(0, pos).trim();
const cookieValue = cookieStr.slice(pos + 1).trim();
return name === cookieName && value === cookieValue;
});
};

The value is $now$, but cookieValue is created by Date.now().toString(), so it's something like 1677324255603 and function returns false.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions