Skip to content

Commit bb1611a

Browse files
committed
Fix Electron browser detection order in inferBrowser
Move the Electron check before the Chrome check since Electron's user-agent string always contains 'Chrome/', making the Electron branch unreachable when placed after the Chrome check.
1 parent 16a5be7 commit bb1611a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/server/src/auth/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ function inferBrowser(userAgent: string | undefined): string | undefined {
6767
const normalized = userAgent;
6868
if (/Edg\//.test(normalized)) return "Edge";
6969
if (/OPR\//.test(normalized)) return "Opera";
70+
if (/Electron\//.test(normalized)) return "Electron";
7071
if (/Firefox\//.test(normalized)) return "Firefox";
7172
if (/Chrome\//.test(normalized) || /CriOS\//.test(normalized)) return "Chrome";
7273
if (/Safari\//.test(normalized) && !/Chrome\//.test(normalized)) return "Safari";
73-
if (/Electron\//.test(normalized)) return "Electron";
7474
return undefined;
7575
}
7676

0 commit comments

Comments
 (0)