Skip to content

Commit

Permalink
fix: [DHIS2-17322] Ensure app hub id is in the right format
Browse files Browse the repository at this point in the history
  • Loading branch information
JoakimSM committed Sep 26, 2024
1 parent a116aa6 commit 97a5336
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
23 changes: 21 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2022-11-16T12:52:56.478Z\n"
"PO-Revision-Date: 2022-11-16T12:52:56.478Z\n"
"POT-Creation-Date: 2024-09-26T12:27:51.211Z\n"
"PO-Revision-Date: 2024-09-26T12:27:51.211Z\n"

msgid ""
"Your session has expired. Please refresh the page and login before trying "
"again."
msgstr ""
"Your session has expired. Please refresh the page and login before trying "
"again."

msgid "An unexpected error occurred"
msgstr "An unexpected error occurred"

msgid "Version {{version}} installed"
msgstr "Version {{version}} installed"
Expand Down Expand Up @@ -56,12 +66,18 @@ msgstr "App uninstalled successfully"
msgid "Failed to uninstall app: {{errorMessage}}"
msgstr "Failed to uninstall app: {{errorMessage}}"

msgid "Installing..."
msgstr "Installing..."

msgid "Update to latest version"
msgstr "Update to latest version"

msgid "Install"
msgstr "Install"

msgid "There are no compatible versions available."
msgstr "There are no compatible versions available."

msgid "{{channel}} release {{version}}"
msgstr "{{channel}} release {{version}}"

Expand Down Expand Up @@ -155,6 +171,9 @@ msgstr "All installed custom apps"
msgid "Search installed custom apps"
msgstr "Search installed custom apps"

msgid "View app details"
msgstr "View app details"

msgid "Uploading..."
msgstr "Uploading..."

Expand Down
9 changes: 8 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import { InstalledApp } from './pages/InstalledApp/InstalledApp.js'
import { ManualInstall } from './pages/ManualInstall/ManualInstall.js'
import './locales/index.js'

// Used to ensure we are matching the pattern of a valid app hub id, which should be a UUID version 4
const APP_HUB_ID_REGEXP =
'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'

const App = () => (
<HashRouter>
<QueryParamProvider
Expand All @@ -37,7 +41,10 @@ const App = () => (
component={InstalledApp}
/>
<Route path="/app-hub" component={AppHub} />
<Route path="/app/:appHubId" component={AppHubApp} />
<Route
path={`/app/:appHubId(${APP_HUB_ID_REGEXP})`}
component={AppHubApp}
/>
<Route
path="/manual-install"
component={ManualInstall}
Expand Down

0 comments on commit 97a5336

Please sign in to comment.