Skip to content

Commit 656b0c5

Browse files
committed
change order of validation and all trycatch in semver check
Signed-off-by: Joanne Wang <[email protected]>
1 parent 03bc72c commit 656b0c5

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

public/utils/helpers.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,18 @@ export function getManageChannelsUrl() {
174174
}
175175

176176
export function dataSourceFilterFn(dataSource) {
177-
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || '';
178-
const installedPlugins = dataSource?.attributes?.installedPlugins || [];
179-
return (
180-
semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions) &&
181-
pluginManifest.requiredOSDataSourcePlugins.every((plugin) => installedPlugins.includes(plugin))
182-
);
177+
try {
178+
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || '';
179+
const installedPlugins = dataSource?.attributes?.installedPlugins || [];
180+
return (
181+
pluginManifest.requiredOSDataSourcePlugins.every((plugin) =>
182+
installedPlugins.includes(plugin)
183+
) && semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions)
184+
);
185+
} catch (error) {
186+
// Filter out invalid data source
187+
return false;
188+
}
183189
}
184190

185191
export function getSeverityText(severity) {

0 commit comments

Comments
 (0)