Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/healthy-rabbits-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes an issue where `user-agent` is not properly extracted from the DDP connection headers
7 changes: 3 additions & 4 deletions apps/meteor/ee/server/lib/deviceManagement/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Users } from '@rocket.chat/models';
import { Accounts } from 'meteor/accounts-base';
import { Meteor } from 'meteor/meteor';
import moment from 'moment';
import type { Headers } from 'node-fetch';
import { UAParser } from 'ua-parser-js';

import * as Mailer from '../../../../app/mailer/server/api';
Expand Down Expand Up @@ -67,9 +66,9 @@ export const listenSessionLogin = () => {
username,
emails: [{ address: email }],
} = user;
// TODO: Find why the httpheaders is being casted to IncomingHttpHeaders instead of Headers
const userAgentString = connection?.httpHeaders && (connection.httpHeaders as unknown as Headers).get('user-agent');
const { browser, os, device, cpu, app } = await uaParser(userAgentString || '');

const userAgentString = connection?.httpHeaders?.['user-agent'] ?? '';
const { browser, os, device, cpu, app } = await uaParser(userAgentString);

const mailData = {
name,
Expand Down
Loading