From e076d856db4d432dc19408696d273fbfd75acb8d Mon Sep 17 00:00:00 2001 From: Thomas Neidhart Date: Mon, 20 Apr 2026 14:58:37 +0200 Subject: [PATCH] fix: add download url for errroed extension scans --- .../src/main/java/org/eclipse/openvsx/admin/ScanAPI.java | 6 ++++-- .../scan-admin/scan-card/scan-card-expanded-content.tsx | 8 ++++---- webui/src/components/scan-admin/scan-card/utils.ts | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/org/eclipse/openvsx/admin/ScanAPI.java b/server/src/main/java/org/eclipse/openvsx/admin/ScanAPI.java index 86ad87841..43b732688 100644 --- a/server/src/main/java/org/eclipse/openvsx/admin/ScanAPI.java +++ b/server/src/main/java/org/eclipse/openvsx/admin/ScanAPI.java @@ -914,6 +914,7 @@ private void populateExtensionMetadata(ScanStatus scanStatus, ScanResultJson jso json.setDisplayName(version.getDisplayName()); var isQuarantined = scanStatus == ScanStatus.QUARANTINED; + var isErrored = scanStatus == ScanStatus.ERRORED; var fileTypes = isQuarantined ? new String[] { FileResource.ICON } : new String[] { FileResource.ICON, FileResource.DOWNLOAD }; @@ -931,9 +932,10 @@ private void populateExtensionMetadata(ScanStatus scanStatus, ScanResultJson jso json.setExtensionIcon(iconUrl); } - // if the extension is quarantined, + // if the extension is quarantined or errored, // resolve the download location as the api endpoint will return 404. - if (isQuarantined) { + // TODO: this does not work when using local storage as in this case always an api url is returned + if (isQuarantined || isErrored) { var downloadResource = repositories.findFileByType(version, FileResource.DOWNLOAD); if (downloadResource != null) { var url = storageUtil.getLocation(downloadResource); diff --git a/webui/src/components/scan-admin/scan-card/scan-card-expanded-content.tsx b/webui/src/components/scan-admin/scan-card/scan-card-expanded-content.tsx index 955ef962e..0bfb1b196 100644 --- a/webui/src/components/scan-admin/scan-card/scan-card-expanded-content.tsx +++ b/webui/src/components/scan-admin/scan-card/scan-card-expanded-content.tsx @@ -11,7 +11,7 @@ * SPDX-License-Identifier: EPL-2.0 ********************************************************************************/ -import { FC } from "react"; +import { FC } from 'react'; import { Box, Typography, Collapse, Chip } from '@mui/material'; import { useTheme, Theme } from '@mui/material/styles'; import { ScanResult, Threat, ValidationFailure, CheckResult } from '../../../context/scan-admin'; @@ -63,7 +63,7 @@ const ThreatItem: FC = ({ threat }) => { /** * A single validation failure item in the expanded content. */ -const ValidationFailureItem: React.FC = ({ failure }) => { +const ValidationFailureItem: FC = ({ failure }) => { const theme = useTheme(); const isUnenforced = !failure.enforcedFlag; @@ -119,7 +119,7 @@ const formatDuration = (ms: number | null): string | undefined => { /** * A single check result item showing what check was run and its outcome. */ -const CheckResultItem: React.FC = ({ checkResult }) => { +const CheckResultItem: FC = ({ checkResult }) => { const theme = useTheme(); const colors = getCheckResultColor(checkResult.result, theme); const isPassed = checkResult.result === 'PASSED'; @@ -182,7 +182,7 @@ const CheckResultItem: React.FC = ({ checkResult }) => { * The expanded content section showing threats, validation failures, and check results. * Each item's enforcedFlag controls its individual striping effect. */ -export const ScanCardExpandedContent: React.FC = ({ scan, expanded, onCollapseComplete }) => { +export const ScanCardExpandedContent: FC = ({ scan, expanded, onCollapseComplete }) => { const theme = useTheme(); const hasThreats = scan.threats.length > 0; const hasValidationFailures = scan.validationFailures.length > 0; diff --git a/webui/src/components/scan-admin/scan-card/utils.ts b/webui/src/components/scan-admin/scan-card/utils.ts index 5730a16f9..b458b1685 100644 --- a/webui/src/components/scan-admin/scan-card/utils.ts +++ b/webui/src/components/scan-admin/scan-card/utils.ts @@ -189,7 +189,7 @@ export const shouldShowExpandButton = (scan: ScanResult): boolean => { }; export const hasDownload = (scan: ScanResult): boolean => { - return scan.status === 'PASSED' || scan.status === 'QUARANTINED'; + return scan.status === 'PASSED' || scan.status === 'QUARANTINED' || scan.status === 'ERROR'; }; export const getFileName = (url?: string): string => {