Skip to content

Commit 24a5217

Browse files
[Fleet] Add error message/status when dragging/dropping non-svg into custom integration (#226294)
## Summary Closes #225795 - Added error message/status when dragging and dropping in a non-SVG file. Browsing already handled the case so no change needed. https://github.com/user-attachments/assets/9bf362fe-f10e-4bf5-a5ec-4e46bd71bd01 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks N/A --------- Co-authored-by: Elastic Machine <[email protected]>
1 parent 9bd021b commit 24a5217

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

x-pack/platform/plugins/shared/automatic_import/public/components/create_integration/create_automatic_import/steps/integration_step/integration_step.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ export const IntegrationStep = React.memo<IntegrationStepProps>(({ integrationSe
7777
setLogoError(`${logoFile.name} is too large, maximum size is 1Mb.`);
7878
return;
7979
}
80+
// make sure the logo is a svg type in the case of drag and drop
81+
if (!logoFile.name.endsWith('.svg') || !logoFile.type.startsWith('image/svg+xml')) {
82+
setLogoError(i18n.NON_SVG_ERROR);
83+
return;
84+
}
8085
logoFile
8186
.arrayBuffer()
8287
.then((fileBuffer) => {

x-pack/platform/plugins/shared/automatic_import/public/components/create_integration/create_automatic_import/steps/integration_step/translations.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,10 @@ export const PREVIEW_TOOLTIP = i18n.translate(
5151
export const LOGO_ERROR = i18n.translate('xpack.automaticImport.step.integration.logo.error', {
5252
defaultMessage: 'Error processing logo file',
5353
});
54+
55+
export const NON_SVG_ERROR = i18n.translate(
56+
'xpack.automaticImport.step.integration.logo.nonSvgError',
57+
{
58+
defaultMessage: 'Only SVG files are allowed',
59+
}
60+
);

0 commit comments

Comments
 (0)