Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
467c848
fix: image upload failing for specific jpegs
cardoso Apr 17, 2025
e35a9f2
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
cardoso Apr 20, 2025
ef168d3
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Apr 21, 2025
1216317
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso Apr 22, 2025
ad646da
fix: display error indicator when image upload fails
cardoso Apr 22, 2025
36c44ad
test: with and without Message_Attachments_Strip_Exif
cardoso Apr 22, 2025
0fee022
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
cardoso Apr 24, 2025
86a7e82
chore: add changeset
cardoso Apr 24, 2025
8545447
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
cardoso Apr 24, 2025
ca4c75c
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
cardoso Apr 25, 2025
a90d908
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
cardoso Apr 29, 2025
3d68509
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
cardoso Apr 29, 2025
5d41a4b
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
cardoso Apr 30, 2025
ba30030
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
cardoso May 7, 2025
7c96888
fix: handle possible empty string
cardoso May 7, 2025
e3caef8
fix: handle possible empty string
cardoso May 7, 2025
eca914b
fix: handle error response for file upload in send function
cardoso May 7, 2025
04c87e2
fix: UploadProgressIndicator a11y
dougfabris May 8, 2025
525b023
test: updates image upload error selector
cardoso May 8, 2025
e26d291
fix: review
dougfabris May 8, 2025
f893616
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
kodiakhq[bot] May 9, 2025
bff8ede
Merge branch 'develop' into SUP-769-Image-Upload-Display-Error-Messag…
kodiakhq[bot] May 9, 2025
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
18 changes: 10 additions & 8 deletions apps/meteor/client/lib/chats/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ const send = async (
): Promise<void> => {
const id = Random.id();

updateUploads((uploads) => [
...uploads,
{
id,
name: fileContent?.raw.name || file.name,
percentage: 0,
},
]);
const upload: Upload = {
id,
name: fileContent?.raw.name || file.name,
percentage: 0,
};

updateUploads((uploads) => [...uploads, upload]);

try {
await new Promise((resolve, reject) => {
Expand Down Expand Up @@ -128,6 +127,9 @@ const send = async (
t,
content,
});
} else if (xhr.readyState === xhr.DONE && xhr.status === 400) {
Comment thread
cardoso marked this conversation as resolved.
Outdated
const error = JSON.parse(xhr.responseText);
updateUploads((uploads) => [...uploads, { ...upload, error: new Error(error.error) }]);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const UploadProgressIndicator = ({ id, name, percentage, error, onClose }: Uploa
className={customClass}
>
<Box withTruncatedText zIndex={2} borderRadius={4}>
[{percentage}%] {name}
[{percentage}%] {name} {error && ` - ${error}`}
Comment thread
cardoso marked this conversation as resolved.
Outdated
</Box>
<Button zIndex={3} small onClick={handleCloseClick}>
{t('Cancel')}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions apps/meteor/tests/e2e/image-upload.spec.ts
Comment thread
dougfabris marked this conversation as resolved.
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('image-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 show error indicator when upload fails', async ({ page }) => {
await poHomeChannel.content.sendFileMessage('bad-orientation.jpeg');
await poHomeChannel.content.fileNameInput.fill('bad-orientation.jpeg');
await poHomeChannel.content.descriptionInput.fill('bad-orientation_description');
await poHomeChannel.content.btnModalConfirm.click();

await expect(page.getByText('bad-orientation.jpeg')).toContainText('Error:');
Comment thread
cardoso marked this conversation as resolved.
Outdated
});
});

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

test('should succeed upload of bad-orientation.jpeg', async () => {
await poHomeChannel.content.sendFileMessage('bad-orientation.jpeg');
await poHomeChannel.content.fileNameInput.fill('bad-orientation.jpeg');
await poHomeChannel.content.descriptionInput.fill('bad-orientation_description');
await poHomeChannel.content.btnModalConfirm.click();

await expect(poHomeChannel.content.getFileDescription).toHaveText('bad-orientation_description');
});
});
});