Skip to content

Commit

Permalink
compare tarball string as well in the generation phase to prevent bad…
Browse files Browse the repository at this point in the history
… tarball url (#2487)

* check tarball string as well in the generation phase

* correct tarball path compare

* update to preserve Dist content while update it's path only

* add detection of null in dist

* add setter
  • Loading branch information
shokakucarrier authored Dec 12, 2024
1 parent 4e6c799 commit 3a614ea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,19 @@ private boolean writePackageMetadata( List<StoreResource> firstLevelFiles, Artif
}

// Generate tarball url if missing
String tarball = "http://indy/" + packagePath.getTarPath(); // here we use mock host. indy will amend it with the right hostname
if ( versionMetadata.getDist() == null )
{
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 );
versionMetadata.setDist( new Dist( tarball ) );
versionMetadata.setDist( new Dist( tarball ) );
} else {
// Detect bad tarball and replace with correct one
if ( versionMetadata.getDist().getTarball() == null || !versionMetadata.getDist().getTarball().endsWith(packagePath.getTarPath()) )
{
Dist dist = versionMetadata.getDist();
dist.setTarball( tarball );
versionMetadata.setDist( dist );
}
}
}
catch ( IOException e )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Dist

private final String shasum;

private final String tarball;
private String tarball;

private final String integrity;

Expand Down Expand Up @@ -69,6 +69,11 @@ public String getTarball()
return tarball;
}

public void setTarball( String tarball )
{
this.tarball = tarball;
}

public String getIntegrity()
{
return integrity;
Expand Down

0 comments on commit 3a614ea

Please sign in to comment.