Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/services/providers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ export const PROVIDER_FETCH_LIMIT = 100
export const VERSION_FETCH_TIMEOUT = 5_000
export const VERSION_FETCH_CONCURRENCY = 20
export const PDP_PRODUCT_TYPE = 0

export const VERSION_PATTERN =
/^\d+\.\d+\.\d+\+\w+\+git_[a-f0-9]+_\d{4}-\d{2}-\d{2}T[\d:+-]+$/
8 changes: 5 additions & 3 deletions src/services/providers/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { VERSION_FETCH_TIMEOUT, VERSION_PATTERN } from './constants'
import { parseVersionString } from '@filecoin-foundation/ui-filecoin/Table/SoftwareVersion'

import { VERSION_FETCH_TIMEOUT } from './constants'

/**
* Parse version from response text
Expand All @@ -19,10 +21,10 @@ function parseVersionFromResponse(responseText: string): string {
}

/**
* Validate version string format
* Validate a version string using the same parser as the table display and CSV.
*/
function isValidVersion(version: string): boolean {
return VERSION_PATTERN.test(version)
return parseVersionString(version) !== undefined
}
Comment on lines +24 to 28

/**
Expand Down