Skip to content

Conversation

@risu729
Copy link
Contributor

@risu729 risu729 commented Jul 15, 2025

Resolves #5643.
However, since this is a patch only for aqua:gitea.com/gitea/tea, as it's the only package using Gitea, I don't think we should fix this on our end.

I opened an issue go-gitea/gitea#35086.

@risu729 risu729 changed the title test(aqua): test aqua:gitea.com/gitea/tea fix(aqua): fix 403 forbidden error for aqua:gitea.com/gitea/tea Jul 15, 2025
@risu729 risu729 marked this pull request as ready for review July 15, 2025 19:28
Copilot AI review requested due to automatic review settings July 15, 2025 19:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes 403 errors when fetching attachments from Gitea by using GET requests instead of HEAD, and adds an end-to-end test for the Gitea tea package.

  • Use HTTP GET for Gitea URLs in AquaBackend::Http to work around missing HEAD support
  • Add an E2E test for aqua:gitea.com/gitea/[email protected]

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/backend/aqua.rs Detect gitea.com URLs and use HTTP.get_async instead of HEAD
e2e/backend/test_aqua Add test case for tea --version including ANSI-formatted output
Comments suppressed due to low confidence (1)

src/backend/aqua.rs:268

  • The new GET branch for Gitea URLs isn't covered by existing unit tests. Consider adding a unit or integration test that mocks HTTP requests to verify this branch behaves as expected and handles errors correctly.
                    HTTP.get_async(&url).await?;

let url = pkg.url(v)?;
HTTP.head(&url).await?;
// Gitea doesn't support HEAD requests for attachments, so use GET instead
if url.contains("gitea.com") {
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using url.contains("gitea.com") may unintentionally match substrings in paths or query parameters. Consider parsing the URL with a proper URL parser (e.g., url::Url::parse(&url)) and checking the host directly to ensure accuracy.

Copilot uses AI. Check for mistakes.
@risu729 risu729 closed this Jul 15, 2025
@risu729 risu729 deleted the aqua-gitea-tea branch July 15, 2025 19:48
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.

1 participant