Skip to content

Commit

Permalink
Merge pull request #452 from hearchco/as/fix/versions
Browse files Browse the repository at this point in the history
fix(versions): better extract func and apply to frontend as well
  • Loading branch information
aleksasiriski authored Aug 25, 2024
2 parents 622db70 + 04ad15f commit ce8d86c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/routes/+layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fetchVersion } from '$lib/functions/api/fetchversion';
export async function load({ fetch }) {
const apiVersion = await fetchVersion(fetch);
return {
uiVersion: PUBLIC_UI_VERSION ?? 'dev',
uiVersion: extractVersion(PUBLIC_UI_VERSION) ?? 'dev',
apiVersion: extractVersion(apiVersion) ?? 'dev'
};
}
Expand All @@ -16,7 +16,7 @@ export async function load({ fetch }) {
*/
function extractVersion(input) {
// Regular expression to match the version part
const versionRegex = /^v\d+\.\d+\.\d+/;
const versionRegex = /v\d+\.\d+\.\d+(-preview)?/;
const match = input.match(versionRegex);

// Return the matched version or null if not found
Expand Down

0 comments on commit ce8d86c

Please sign in to comment.