Skip to content

Fix repo URL validation rejecting non-GitHub and self-hosted forges#60

Merged
Sunilshah-7 merged 1 commit into
chaoss:mainfrom
Pippiblip:fix/gitlab-readme-fetch-issue
Jul 22, 2026
Merged

Fix repo URL validation rejecting non-GitHub and self-hosted forges#60
Sunilshah-7 merged 1 commit into
chaoss:mainfrom
Pippiblip:fix/gitlab-readme-fetch-issue

Conversation

@Pippiblip

Copy link
Copy Markdown

Problem:
The frontend only accepted URLs containing the literal string 'github.com':
if (projectUrl.includes('github.com') === false) { reject }

This rejected every GitLab, Codeberg, and Bitbucket URL outright, including self-hosted instances like:
https://gitlab.windenergy.dtu.dk/pyconturb/pyconturb

Requests were blocked client-side before ever reaching the backend, even though repository_provider.py already supports GitHub, GitLab (including self-hosted, via _detect_engine()), Codeberg, and Bitbucket.

Fix:
Replace the single-host substring check with a structural check: any URL with a valid scheme/host and an /owner/repo-shaped path is accepted client-side. Real host support is left to the backend, which already has detection logic and returns UnsupportedHostError for genuinely unsupported hosts.

const url = new URL(projectUrl);
isValidRepoUrl = /^/[^/]+/[^/]+/.test(url.pathname);

Problem:
The frontend only accepted URLs containing the literal string
'github.com':
  if (projectUrl.includes('github.com') === false) { reject }

This rejected every GitLab, Codeberg, and Bitbucket URL outright,
including self-hosted instances like:
  https://gitlab.windenergy.dtu.dk/pyconturb/pyconturb

Requests were blocked client-side before ever reaching the backend,
even though repository_provider.py already supports GitHub, GitLab
(including self-hosted, via _detect_engine()), Codeberg, and Bitbucket.

Fix:
Replace the single-host substring check with a structural check: any
URL with a valid scheme/host and an /owner/repo-shaped path is
accepted client-side. Real host support is left to the backend, which
already has detection logic and returns UnsupportedHostError for
genuinely unsupported hosts.

  const url = new URL(projectUrl);
  isValidRepoUrl = /^\/[^/]+\/[^/]+/.test(url.pathname);

Signed-off-by: Pippiblip <peterpie575@users.noreply.github.com>
@Sunilshah-7
Sunilshah-7 merged commit 1785602 into chaoss:main Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants