-
Notifications
You must be signed in to change notification settings - Fork 106
Align gitea clone_url with gitea host url. Addresses #270 #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe Changes
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/backend/src/repoCompileUtils.ts (2)
185-231
: Consider adding error handling for URL parsingWhile the implementation is correct, the code doesn't handle potential URL parsing errors that could occur if either
hostUrl
orrepo.clone_url
is malformed.Consider adding error handling around the URL creation:
const repos = giteaRepos.map((repo) => { - const configUrl = new URL(hostUrl); - const cloneUrl = new URL(repo.clone_url!); - cloneUrl.host = configUrl.host + try { + const configUrl = new URL(hostUrl); + const cloneUrl = new URL(repo.clone_url!); + cloneUrl.host = configUrl.host; + + const repoDisplayName = repo.full_name!; + const repoName = path.join(repoNameRoot, repoDisplayName); + + logger.debug(`Found gitea repo ${repoDisplayName} with webUrl: ${repo.html_url}`); + + // Rest of the code... + } catch (error) { + logger.error(`Failed to process Gitea repo: ${repo.full_name}`, error); + throw new Error(`Invalid URL format for Gitea repository: ${error.message}`); + }
186-187
: Consider adding a debug log for clone URL changesAdding a debug log statement would help when troubleshooting URL transformation issues in the future.
const configUrl = new URL(hostUrl); const cloneUrl = new URL(repo.clone_url!); + logger.debug(`Replacing Gitea clone URL host from ${cloneUrl.host} to ${configUrl.host}`); cloneUrl.host = configUrl.host
Thanks! |
This PR aligns gitea cloneUrl with hostUrl. When gitea is deployed as part of a docker-compose stack, it will incorrectly get the
cloneUrl
from the gitea API which will indicatelocalhost
which is not correct. This will case sourcebot to fail when cloning the repo.This fix ensures that the user specified
host
url is always used when cloning repos also. Addresses #270Summary by CodeRabbit