Link detected cookies to existing patterns on conflict
When a cookie pattern already exists for a banner, the insert conflict caused a continue that silently dropped the detected cookie instead of linking it to the existing pattern. Load the existing pattern to obtain its ID and proceed with cookie insertion. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -43,8 +43,10 @@ export function humanizeSeconds(seconds: number | null): string {
|
||||
}
|
||||
|
||||
export function toMaxAgeSeconds(value: string, unit: string): number | null {
|
||||
const num = parseFloat(value);
|
||||
if (isNaN(num) || num <= 0) return null;
|
||||
const trimmed = value.trim();
|
||||
if (trimmed === "" || !/^\d+(\.\d+)?$/.test(trimmed)) return null;
|
||||
const num = Number(trimmed);
|
||||
if (!Number.isFinite(num) || num <= 0) return null;
|
||||
const u = DURATION_UNITS.find(u => u.value === unit);
|
||||
if (!u) return null;
|
||||
const rounded = Math.round(num * u.seconds);
|
||||
|
||||
Reference in New Issue
Block a user