mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-07 05:42:42 +00:00
Fix bug with PoolPath field being overwritten on mirror update
While updating mirror, if package file is already in pool path, field `PoolPath` was left as empty which results in package file being unavailable later on while publishing.
This commit is contained in:
+4
-3
@@ -629,14 +629,15 @@ type PackageDownloadTask struct {
|
||||
func (p *Package) DownloadList(packagePool aptly.PackagePool, checksumStorage aptly.ChecksumStorage) (result []PackageDownloadTask, err error) {
|
||||
result = make([]PackageDownloadTask, 0, 1)
|
||||
|
||||
for idx, f := range p.Files() {
|
||||
verified, err := f.Verify(packagePool, checksumStorage)
|
||||
files := p.Files()
|
||||
for idx := range files {
|
||||
verified, err := files[idx].Verify(packagePool, checksumStorage)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !verified {
|
||||
result = append(result, PackageDownloadTask{File: &p.Files()[idx]})
|
||||
result = append(result, PackageDownloadTask{File: &files[idx]})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,12 @@ type PackageFile struct {
|
||||
|
||||
// Verify that package file is present and correct
|
||||
func (f *PackageFile) Verify(packagePool aptly.PackagePool, checksumStorage aptly.ChecksumStorage) (bool, error) {
|
||||
return packagePool.Verify(f.PoolPath, f.Filename, &f.Checksums, checksumStorage)
|
||||
generatedPoolPath, exists, err := packagePool.Verify(f.PoolPath, f.Filename, &f.Checksums, checksumStorage)
|
||||
if exists && err == nil {
|
||||
f.PoolPath = generatedPoolPath
|
||||
}
|
||||
|
||||
return exists, err
|
||||
}
|
||||
|
||||
// GetPoolPath returns path to the file in the pool
|
||||
|
||||
Reference in New Issue
Block a user