Improve image upload error handling and validation (#17188)

- Add URL validation in getImageBufferFromUrl utility
- Add response status validation and content-type checking
- Add timeout and connection error handling with specific error messages
- Validate buffer is not empty before processing
- Validate file type detection results before proceeding
- Ensure detected file type is actually an image format
- Add proper type safety for Axios error handling

This improves robustness when uploading images from URLs by:
- Preventing invalid URLs from being processed
- Providing clear error messages for different failure scenarios
- Ensuring only valid image files are processed
- Handling network errors gracefully

---------

Co-authored-by: GitTensor Miner <miner@gittensor.io>
This commit is contained in:
Angel98518
2026-01-19 16:40:02 +08:00
committed by GitHub
parent 5cef07af45
commit 92a080b704
4 changed files with 82 additions and 7 deletions
@@ -105,6 +105,8 @@ export class LoginPage {
}
async typeEmail(email: string) {
// Wait for the email field to be visible before trying to interact
await this.emailField.waitFor({ state: 'visible' });
await expect(this.emailField).toBeVisible();
await this.emailField.fill(email);
@@ -47,6 +47,8 @@ test('Create workflow', async ({ page }) => {
.getByTestId('top-bar-title')
.getByText(NEW_WORKFLOW_NAME);
// Wait for the name to be visible and not hidden
await workflowName.waitFor({ state: 'visible' });
await expect(workflowName).toBeVisible();
await expect(page).toHaveURL(`/object/workflow/${newWorkflowId}`);