Check the validity of the generatorURL field

The Source button should only be displayed if the link starts by
'http://' or 'https://'.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2023-08-23 13:36:30 +02:00
parent 0f80a72ee2
commit 236ce26e55
3 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,4 @@
## 0.26.0-rc.0 / 2023-08-17 ## 0.26.0 / 2022-08-23
* [CHANGE] Telegram Integration: `api_url` is now optional. #2981 * [CHANGE] Telegram Integration: `api_url` is now optional. #2981
* [CHANGE] Telegram Integration: `ParseMode` default is now `HTML` instead of `MarkdownV2`. #2981 * [CHANGE] Telegram Integration: `ParseMode` default is now `HTML` instead of `MarkdownV2`. #2981
@ -25,6 +25,7 @@
* [BUGFIX] API: Fixed duplicate receiver names in the `api/v2/receivers` API endpoint. #3338 * [BUGFIX] API: Fixed duplicate receiver names in the `api/v2/receivers` API endpoint. #3338
* [BUGFIX] API: Attempting to delete a silence now returns the correct status code, `404` instead of `500`. #3352 * [BUGFIX] API: Attempting to delete a silence now returns the correct status code, `404` instead of `500`. #3352
* [BUGFIX] Clustering: Fixes a panic when `tls_client_config` is empty. #3443 * [BUGFIX] Clustering: Fixes a panic when `tls_client_config` is empty. #3443
* [BUGFIX] Fix stored XSS via the /api/v1/alerts endpoint in the Alertmanager UI.
## 0.25.0 / 2022-12-22 ## 0.25.0 / 2022-12-22

File diff suppressed because one or more lines are too long

View File

@ -45,8 +45,12 @@ titleView alert =
generatorUrlButton : String -> Html msg generatorUrlButton : String -> Html msg
generatorUrlButton url = generatorUrlButton url =
a if String.startsWith "http://" url || String.startsWith "https://" url then
[ class "btn btn-outline-info border-0", href url ] a
[ i [ class "fa fa-line-chart mr-2" ] [] [ class "btn btn-outline-info border-0", href url ]
, text "Source" [ i [ class "fa fa-line-chart mr-2" ] []
] , text "Source"
]
else
text ""