Skip to content

Commit

Permalink
Fix duplicate version prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
cgero-eth committed Jul 9, 2024
1 parent 03a1225 commit 3e37c7b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/utils/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1286,8 +1286,8 @@ export const walletInWalletList = (
export function compareVersions(version1: string, version2: string): number {
if (!version1 || !version2) return 0;

const v1 = version1.split('.').map(Number);
const v2 = version2.split('.').map(Number);
const v1 = normalizeVersion(version1).split('.').map(Number);
const v2 = normalizeVersion(version2).split('.').map(Number);

for (let i = 0; i < v1.length; i++) {
if (v1[i] > v2[i]) {
Expand All @@ -1300,6 +1300,14 @@ export function compareVersions(version1: string, version2: string): number {
return 0;
}

export function normalizeVersion(version: string): string {
if (version.startsWith('v')) {
return version.slice(1);
}

return version;
}

/**
* Retrieves the repository address for a specific plugin type on a supported network and protocol version.
* @param network - The supported network
Expand Down
5 changes: 4 additions & 1 deletion src/utils/osxUpdates.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {IReleaseNote} from 'services/aragon-sdk/domain/release-note';
import {VersionTag} from '@aragon/sdk-client-common';
import {normalizeVersion} from './library';

export interface IGetReleaseNotesParams {
releases?: IReleaseNote[];
Expand All @@ -17,7 +18,9 @@ class OsxUpdates {
? version.join('.')
: version;

return processedVersion ? `Aragon OSx v${processedVersion}` : undefined;
return processedVersion
? `Aragon OSx v${normalizeVersion(processedVersion)}`
: undefined;
};

getPluginVersion = (version?: VersionTag): string | undefined => {
Expand Down

0 comments on commit 3e37c7b

Please sign in to comment.