diff --git a/src/renderer/components/+extensions/extensions.tsx b/src/renderer/components/+extensions/extensions.tsx index 1c55c86ecd..831ec6c1cd 100644 --- a/src/renderer/components/+extensions/extensions.tsx +++ b/src/renderer/components/+extensions/extensions.tsx @@ -313,9 +313,13 @@ export async function attemptInstallByInfo({ name, version, requireConfirmation if (version) { if (!json.versions[version]) { - Notifications.error(

The {name} extension does not have a v{version}.

); - - return disposer(); + if (json["dist-tags"][version]) { + version = json["dist-tags"][version]; + } else { + Notifications.error(

The {name} extension does not have a version or tag {version}.

); + + return disposer(); + } } } else { const versions = Object.keys(json.versions) @@ -490,18 +494,12 @@ export class Extensions extends React.Component { } componentDidMount() { - // TODO: change this after upgrading to mobx6 as that versions' reactions have this functionality - let prevSize = ExtensionLoader.getInstance().userExtensions.size; - disposeOnUnmount(this, [ - reaction(() => ExtensionLoader.getInstance().userExtensions.size, curSize => { - try { - if (curSize > prevSize) { - when(() => !ExtensionInstallationStateStore.anyInstalling) - .then(() => this.installPath = ""); - } - } finally { - prevSize = curSize; + reaction(() => ExtensionLoader.getInstance().userExtensions.size, (curSize, prevSize) => { + if (curSize > prevSize) { + disposeOnUnmount(this, [ + when(() => !ExtensionInstallationStateStore.anyInstalling, () => this.installPath = ""), + ]); } }) ]); diff --git a/src/renderer/components/input/input_validators.ts b/src/renderer/components/input/input_validators.ts index 7022527f74..53b84559bc 100644 --- a/src/renderer/components/input/input_validators.ts +++ b/src/renderer/components/input/input_validators.ts @@ -68,7 +68,7 @@ export const isUrl: InputValidator = { }, }; -export const isExtensionNameInstallRegex = /^(?(@[-\w]+\/)?[-\w]+)(@(?\d\.\d\.\d(-\w+)?))?$/gi; +export const isExtensionNameInstallRegex = /^(?(@[-\w]+\/)?[-\w]+)(@(?[a-z0-9-_.]+))?$/gi; export const isExtensionNameInstall: InputValidator = { condition: ({ type }) => type === "text",