Skip to content

Commit

Permalink
fix(frontend): simplify regex
Browse files Browse the repository at this point in the history
  • Loading branch information
fatonramadani committed Oct 11, 2023
1 parent a38f2ad commit 26f8f31
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/src/lib/components/InstanceSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
fieldType: 'text',
placeholder: 'https://windmill.com',
storage: 'setting',
isValid: (value: string | undefined) => value?.match(/^(https?:\/\/)[^\/]+$/) != null
isValid: (value: string | undefined) =>
(value?.startsWith('http') && !value?.endsWith('/')) || false
},
{
label: 'Request Size Limit In MB',
Expand Down Expand Up @@ -289,6 +290,7 @@
<Tooltip>{setting.tooltip}</Tooltip>
{/if}
{#if values}
{@const hasError = setting.isValid && !setting.isValid(values[setting.key])}
{#if setting.fieldType == 'text'}
<input
disabled={setting.ee_only != undefined && !$enterpriseLicense}
Expand Down Expand Up @@ -355,7 +357,7 @@
</div>
{/if}

{#if setting.isValid && !setting.isValid(values[setting.key])}
{#if hasError}
<span class="text-red-500 text-xs">
Base url must start with http:// or https:// and must not end with a
trailing slash.
Expand Down

0 comments on commit 26f8f31

Please sign in to comment.