Skip to content
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

compare tarball string as well in the generation phase to prevent bad tarball url #2487

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ private boolean writePackageMetadata( List<StoreResource> firstLevelFiles, Artif
}

// Generate tarball url if missing
if ( versionMetadata.getDist() == null )
if ( versionMetadata.getDist() == null || !versionMetadata.getDist().getTarball().endsWith(packagePath.getTarPath()) )
Copy link
Member

Choose a reason for hiding this comment

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

The original dist may contain other info that we should keep them as it is, ref: https://github.com/npm/registry/blob/main/docs/responses/package-metadata.md#dist

Or do we need to compare this, can we simply make it in else branch ? to avoid the potential null pointer exception.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have updated it to keep those extra data
And btw do we have linter or formatter?

{
String tarball = "http://indy/" + packagePath.getTarPath(); // here we use mock host. indy will amend it with the right hostname
//logger.debug( "Generate dist tarball: {}", tarball );
Expand Down
Loading