Skip to content

Commit

Permalink
Fix regex for validating mirror remoteUrl
Browse files Browse the repository at this point in the history
Motivation:
The regex for validating mirror remoteUrl is wrong.
`[.-\/]` is interpreted as `.` to `/`. However, it should be `[.\-\/]` which allows `.`, `-` and `/` characters.

Modifications:
- Fixed regex for validating mirror remoteUrl

Result:
- You can now correctly setup a mirror url when it contains `-` in its name.
  • Loading branch information
minwoox committed Aug 28, 2024
1 parent e78a569 commit 19bd468
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ const MirrorForm = ({ projectName, defaultValue, onSubmit, isWaitingResponse }:
type="text"
defaultValue={defaultValue.remoteUrl}
placeholder="my.git.com/org/myrepo.git"
{...register('remoteUrl', { required: true, pattern: /^[\w.-]+(:[0-9]+)?\/[\w.-\/]+.git$/ })}
{...register('remoteUrl', { required: true, pattern: /^[\w.-]+(:[0-9]+)?\/[\w.\-\/]+.git$/ })}
/>
<FieldErrorMessage
error={errors.remoteUrl}
Expand Down

0 comments on commit 19bd468

Please sign in to comment.