fix: avoid overwrite profile properties (geo etc) when profile is from server

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-12-15 22:11:07 +01:00
parent 3b74d8ae36
commit 329f76b7ce

View File

@@ -68,6 +68,30 @@ export class ProfileBuffer extends BaseBuffer {
const existingProfile = await this.fetchProfile(profile, logger);
// Delete any properties that are not server related if we have a non-server profile
if (
existingProfile?.properties.device !== 'server' &&
profile.properties.device === 'server'
) {
profile.properties = omit(
[
'city',
'country',
'region',
'longitude',
'latitude',
'os',
'osVersion',
'browser',
'device',
'isServer',
'os_version',
'browser_version',
],
profile.properties,
);
}
const mergedProfile: IClickhouseProfile = existingProfile
? deepMergeObjects(existingProfile, omit(['created_at'], profile))
: profile;