Skip to content

Commit

Permalink
Don't add URL for unavailable icons
Browse files Browse the repository at this point in the history
  • Loading branch information
dfalbel committed Feb 21, 2025
1 parent ca691ae commit cbde64b
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ export class PositronConnectionsInstance extends BaseConnectionsInstance impleme
try {
// Failing to acquire the icon is fine
// We just log the error
object.metadata.icon = FileAccess.uriToBrowserUri(URI.file(await object.getIcon())).toString();
let icon: string | undefined = await object.getIcon();
if (!icon || icon === '') {
icon = undefined;
} else {
icon = FileAccess.uriToBrowserUri(URI.file(icon)).toString();
}
object.metadata.icon = icon;
} catch (err: any) {
service.log(`Failed to get icon for ${object.id}: ${err.message}`);
}
Expand Down Expand Up @@ -461,7 +467,7 @@ class PositronConnectionItem implements IPositronConnectionItem {

private async getIcon() {
const icon = await this.instance.client.getIcon(this.path);
if (icon === '') {
if (!icon || icon === '') {
return undefined;
} else {
return FileAccess.uriToBrowserUri(URI.file(icon)).toString();
Expand Down

0 comments on commit cbde64b

Please sign in to comment.