Skip to content

Conversation

@jakob-grabner
Copy link

FIXES #1521 pana fails with custom PUB_HOSTED_URL containing a path

When using a custom PUB_HOSTED_URL that includes a path (e.g., hosted on a custom Artifactory server), the pana command fails to analyze packages. The issue seems to occur because the pana package strips away the path component of the PUB_HOSTED_URL when resolving the API endpoint.

My local tests confirm that our custom pub repo can be used after the change.

@google-cla
Copy link

google-cla bot commented Nov 11, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@sigurdm sigurdm requested a review from isoos November 11, 2025 14:57
@sigurdm
Copy link
Contributor

sigurdm commented Nov 11, 2025

Does this work both with custom_repo.com/path and custom_repo.com/path/ ?

Maybe we need to add a final slash to the url if it is not already there...

main() {
  print(Uri.parse('https://pub.dartlang.org/abc').resolve('packages'));
  print(Uri.parse('https://pub.dartlang.org/abc/').resolve('packages'));
}

prints

https://pub.dartlang.org/packages
https://pub.dartlang.org/abc/packages

@jakob-grabner
Copy link
Author

You are right, pub is also normalizing the url https://github.com/dart-lang/pub/blob/28791d3fefb708e6b2b69bee39d8fa12b5ab1541/lib/src/source/hosted.dart#L80

I'm now using the same strategy as pub to normalize trailing slashes.

@sigurdm
Copy link
Contributor

sigurdm commented Nov 13, 2025

Can you sign the CLA?

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.

pana fails with custom PUB_HOSTED_URL containing a path

2 participants