Skip to content

Commit 96ade6f

Browse files
committed
fix: remove https and ssh validation in git repository
1 parent 837160d commit 96ade6f

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/components/material/CreateMaterial.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,13 @@ export class CreateMaterial extends Component<CreateMaterialProps, CreateMateria
118118
}
119119

120120
const res = this.props.providers?.filter((provider) => provider?.id == selectedId) || []
121-
if (res[0]?.authMode != 'SSH') {
122-
if (!url.startsWith('https')) {
123-
return "Git Repo URL must start with 'https:'"
124-
}
121+
122+
if (res[0]?.authMode != 'SSH' && !url.startsWith('https')) {
123+
return "Git Repo URL must start with 'http' or 'https:'"
125124
}
126-
if (res[0]?.authMode === 'SSH') {
127-
if (!url.startsWith('git@')) {
128-
return "Git Repo URL must start with 'git@'"
129-
}
125+
126+
if (res[0]?.authMode === 'SSH' && !url.includes('@')) {
127+
return "URL must contain @"
130128
}
131129
return undefined
132130
}

src/components/material/UpdateMaterial.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,15 @@ export class UpdateMaterial extends Component<UpdateMaterialProps, UpdateMateria
126126
}
127127

128128
const res = this.props.providers?.filter((provider) => provider?.id === selectedId)
129-
if (res[0]?.authMode != 'SSH') {
130-
if (!url.startsWith('https')) {
131-
return "Git Repo URL must start with 'https:'"
132-
}
129+
130+
if (res[0]?.authMode != 'SSH' && !url.startsWith('http')) {
131+
return "Git Repo URL must start with 'http' or 'https:'"
133132
}
134-
if (res[0]?.authMode === 'SSH') {
135-
if (!url.startsWith('git@')) {
136-
return "Git Repo URL must start with 'git@'"
137-
}
133+
134+
if (res[0]?.authMode === 'SSH' && !url.includes('@')) {
135+
return "URL must contain @"
138136
}
137+
139138
return undefined
140139
}
141140

0 commit comments

Comments
 (0)