Skip to content
Closed
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
4 changes: 2 additions & 2 deletions apps/meteor/app/api/server/v1/rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ API.v1.addRoute(
};

const stripExif = settings.get('Message_Attachments_Strip_Exif');
if (stripExif) {
if (stripExif && file.mimetype !== 'application/pdf') {
// No need to check mime. Library will ignore any files without exif/xmp tags (like BMP, ico, PDF, etc)
fileBuffer = await Media.stripExifFromBuffer(fileBuffer);
}
Expand Down Expand Up @@ -286,7 +286,7 @@ API.v1.addRoute(
};

const stripExif = settings.get('Message_Attachments_Strip_Exif');
if (stripExif) {
if (stripExif && file.mimetype !== 'application/pdf') {
// No need to check mime. Library will ignore any files without exif/xmp tags (like BMP, ico, PDF, etc)
fileBuffer = await Media.stripExifFromBuffer(fileBuffer);
}
Expand Down
Binary file not shown.
58 changes: 58 additions & 0 deletions apps/meteor/tests/e2e/pdf-upload.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Users } from './fixtures/userStates';
import { HomeChannel } from './page-objects';
import { createTargetChannel, getSettingValueById, setSettingValueById } from './utils';
import { test, expect } from './utils/test';

test.use({ storageState: Users.user1.state });

test.describe('pdf-upload', () => {
let settingDefaultValue: unknown;
let poHomeChannel: HomeChannel;
let targetChannel: string;

test.beforeAll(async ({ api }) => {
settingDefaultValue = await getSettingValueById(api, 'Message_Attachments_Strip_Exif');
targetChannel = await createTargetChannel(api, { members: ['user1'] });
});

test.beforeEach(async ({ page }) => {
poHomeChannel = new HomeChannel(page);
await page.goto('/home');
await poHomeChannel.sidenav.openChat(targetChannel);
});

test.afterAll(async ({ api }) => {
await setSettingValueById(api, 'Message_Attachments_Strip_Exif', settingDefaultValue);
expect((await api.post('/channels.delete', { roomName: targetChannel })).status()).toBe(200);
});

test.describe('strip exif disabled', () => {
test.beforeAll(async ({ api }) => {
await setSettingValueById(api, 'Message_Attachments_Strip_Exif', false);
});

test('should succeed upload of test_exif_embed.pdf', async () => {
await poHomeChannel.content.sendFileMessage('test_exif_embed.pdf');
await poHomeChannel.content.fileNameInput.fill('test_exif_embed.pdf');
await poHomeChannel.content.descriptionInput.fill('text_exif_embed_description');
await poHomeChannel.content.btnModalConfirm.click();

await expect(poHomeChannel.content.getFileDescription).toHaveText('text_exif_embed_description');
});
});

test.describe('strip exif enabled', () => {
test.beforeAll(async ({ api }) => {
await setSettingValueById(api, 'Message_Attachments_Strip_Exif', true);
});

test('should succeed upload of test_exif_embed.pdf', async () => {
await poHomeChannel.content.sendFileMessage('test_exif_embed.pdf');
await poHomeChannel.content.fileNameInput.fill('test_exif_embed.pdf');
await poHomeChannel.content.descriptionInput.fill('text_exif_embed_description');
await poHomeChannel.content.btnModalConfirm.click();

await expect(poHomeChannel.content.getFileDescription).toHaveText('text_exif_embed_description');
});
});
});
Loading