mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-16 12:08:04 +00:00
We should never ever overwrite files in package pool. #127
This commit is contained in:
@@ -128,16 +128,15 @@ func (pool *PackagePool) Import(path string, hashMD5 string) error {
|
|||||||
// unable to stat target location?
|
// unable to stat target location?
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
// target already exists
|
||||||
|
if targetInfo.Size() != sourceInfo.Size() {
|
||||||
|
// trying to overwrite file?
|
||||||
|
return fmt.Errorf("unable to import into pool: file %s already exists", poolPath)
|
||||||
|
}
|
||||||
|
|
||||||
if targetInfo.Size() != sourceInfo.Size() {
|
// assume that target is already there
|
||||||
// trying to overwrite file?
|
return nil
|
||||||
return fmt.Errorf("unable to import into pool: file %s already exists", poolPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
if os.SameFile(targetInfo, sourceInfo) {
|
|
||||||
// Same file on the filesystem? Just skip it.
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create subdirs as necessary
|
// create subdirs as necessary
|
||||||
|
|||||||
Reference in New Issue
Block a user