mirror of
https://github.com/community-scripts/ProxmoxVE-Local.git
synced 2026-08-01 09:58:59 -04:00
fix: allow nested repository paths in URL validator (#585)
The previous regex required exactly three path segments (host/owner/repo), rejecting nested GitLab group structures such as: https://git.example.com/group/sub-group/repo Replace with a looser pattern that only requires a host and at least one path segment after it, which covers GitHub, GitLab, Bitbucket and self-hosted instances with arbitrarily nested namespaces.
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
* Repository URL validation (JS mirror for server.js).
|
||||
*/
|
||||
const VALID_REPO_URL =
|
||||
/^(https?:\/\/)(github\.com|gitlab\.com|bitbucket\.org|[^/]+)\/[^/]+\/[^/]+$/;
|
||||
/^https?:\/\/[^/]+\/.+$/;
|
||||
|
||||
export const REPO_URL_ERROR_MESSAGE =
|
||||
'Invalid repository URL. Supported: GitHub, GitLab, Bitbucket, and custom Git servers (e.g. https://host/owner/repo).';
|
||||
'Invalid repository URL. Supported: GitHub, GitLab, Bitbucket, and custom Git servers (e.g. https://host/owner/repo or https://host/group/sub-group/repo).';
|
||||
|
||||
export function isValidRepositoryUrl(url) {
|
||||
if (typeof url !== 'string' || !url.trim()) return false;
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
*/
|
||||
|
||||
const VALID_REPO_URL =
|
||||
/^(https?:\/\/)(github\.com|gitlab\.com|bitbucket\.org|[^/]+)\/[^/]+\/[^/]+$/;
|
||||
/^https?:\/\/[^/]+\/.+$/;
|
||||
|
||||
export const REPO_URL_ERROR_MESSAGE =
|
||||
'Invalid repository URL. Supported: GitHub, GitLab, Bitbucket, and custom Git servers (e.g. https://host/owner/repo).';
|
||||
'Invalid repository URL. Supported: GitHub, GitLab, Bitbucket, and custom Git servers (e.g. https://host/owner/repo or https://host/group/sub-group/repo).';
|
||||
|
||||
export type RepoProvider = 'github' | 'gitlab' | 'bitbucket' | 'custom';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user