Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Convert pid for v2

Blue Mouse8cd7e5d5bc53
diff --git a/backend/apps/cloud/src/analytics/protection/analytics-read.util.ts b/backend/apps/cloud/src/analytics/protection/analytics-read.util.ts
index 19482e35b..fdad92f29 100644
--- a/backend/apps/cloud/src/analytics/protection/analytics-read.util.ts
+++ b/backend/apps/cloud/src/analytics/protection/analytics-read.util.ts
@@ -50,6 +50,15 @@ export const getSinglePid = (
const { pid, pids } = query
+ // v1 treats a request carrying BOTH ?pid and ?pids as invalid (getPIDsArray
+ // rejects it). Mirror that here so the publicness/cache decision is never
+ // judged against one project while the handler queries another. Returning
+ // null makes callers fall back to their safe default (skip caching / skip
+ // the public-project rate limit).
+ if (pid !== undefined && pids !== undefined) {
+ return null
+ }
+
if (_isString(pid) && pid) {
return pid
}
diff --git a/backend/apps/community/src/analytics/protection/analytics-read.util.ts b/backend/apps/community/src/analytics/protection/analytics-read.util.ts
index 19482e35b..fdad92f29 100644
--- a/backend/apps/community/src/analytics/protection/analytics-read.util.ts
+++ b/backend/apps/community/src/analytics/protection/analytics-read.util.ts
@@ -50,6 +50,15 @@ export const getSinglePid = (
const { pid, pids } = query
+ // v1 treats a request carrying BOTH ?pid and ?pids as invalid (getPIDsArray
+ // rejects it). Mirror that here so the publicness/cache decision is never
+ // judged against one project while the handler queries another. Returning
+ // null makes callers fall back to their safe default (skip caching / skip
+ // the public-project rate limit).
+ if (pid !== undefined && pids !== undefined) {
+ return null
+ }
+
if (_isString(pid) && pid) {
return pid
}