forked from farhoodlabs/paperclip
refactor: rename URL validators to looksLikeRepoUrl
This commit is contained in:
@@ -118,7 +118,7 @@ export function NewProjectDialog() {
|
||||
|
||||
const isAbsolutePath = (value: string) => value.startsWith("/") || /^[A-Za-z]:[\\/]/.test(value);
|
||||
|
||||
const isGitHubRepoUrl = (value: string) => {
|
||||
const looksLikeRepoUrl = (value: string) => {
|
||||
try {
|
||||
const parsed = new URL(value);
|
||||
if (parsed.protocol !== "https:") return false;
|
||||
@@ -155,7 +155,7 @@ export function NewProjectDialog() {
|
||||
setWorkspaceError("Local folder must be a full absolute path.");
|
||||
return;
|
||||
}
|
||||
if (repoUrl && !isGitHubRepoUrl(repoUrl)) {
|
||||
if (repoUrl && !looksLikeRepoUrl(repoUrl)) {
|
||||
setWorkspaceError("Repo must use a valid GitHub or GitHub Enterprise repo URL.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
|
||||
|
||||
const isAbsolutePath = (value: string) => value.startsWith("/") || /^[A-Za-z]:[\\/]/.test(value);
|
||||
|
||||
const isGitHubRepoUrl = (value: string) => {
|
||||
const looksLikeRepoUrl = (value: string) => {
|
||||
try {
|
||||
const parsed = new URL(value);
|
||||
if (parsed.protocol !== "https:") return false;
|
||||
@@ -431,7 +431,7 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
|
||||
persistCodebase({ repoUrl: null });
|
||||
return;
|
||||
}
|
||||
if (!isGitHubRepoUrl(repoUrl)) {
|
||||
if (!looksLikeRepoUrl(repoUrl)) {
|
||||
setWorkspaceError("Repo must use a valid GitHub or GitHub Enterprise repo URL.");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user