Skip to content

Commit

Permalink
PATCH: Log /file-upload/ requests
Browse files Browse the repository at this point in the history
  • Loading branch information
nmagedman committed Apr 4, 2024
1 parent 7a39249 commit 146d784
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/meteor/app/file-upload/server/lib/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,22 @@ import { Uploads } from '@rocket.chat/models';
import { WebApp } from 'meteor/webapp';

import { FileUpload } from './FileUpload';

Check failure on line 4 in apps/meteor/app/file-upload/server/lib/requests.ts

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

There should be at least one empty line between import groups
import { Logger } from '@rocket.chat/logger';

Check failure on line 5 in apps/meteor/app/file-upload/server/lib/requests.ts

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

`@rocket.chat/logger` import should occur before import of `@rocket.chat/models`

WebApp.connectHandlers.use(FileUpload.getPath(), async (req, res, next) => {
const log = new Logger('FileUpload').logger.child({
url: req.url,
userAgent: req.headers['user-agent'],
userId: req.headers['x-user-id'],
host: req.headers.host,
referer: req.headers.referer,
fastly: req.headers['fastly-client'],
});

log.http({
stage: 'start',
});

const match = /^\/([^\/]+)\/(.*)/.exec(req.url || '');

if (match?.[1]) {
Expand Down

0 comments on commit 146d784

Please sign in to comment.