Merge pull request #53 from safing/fix/file-move-upgrading

Remove version information from moved file
This commit is contained in:
Patrick Pacher 2020-05-23 08:59:13 +02:00 committed by GitHub
commit 6c029d0ce3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -175,7 +175,6 @@ func upgradeFile(fileToUpgrade string, file *updater.File) error {
// test currentVersion for sanity // test currentVersion for sanity
if !rawVersionRegex.MatchString(currentVersion) { if !rawVersionRegex.MatchString(currentVersion) {
log.Tracef("updates: version string returned by %s is invalid: %s", fileToUpgrade, currentVersion) log.Tracef("updates: version string returned by %s is invalid: %s", fileToUpgrade, currentVersion)
currentVersion = "0.0.0"
} }
// try removing old version // try removing old version
@ -192,7 +191,7 @@ func upgradeFile(fileToUpgrade string, file *updater.File) error {
registry.TmpDir().Path, registry.TmpDir().Path,
fmt.Sprintf( fmt.Sprintf(
"%s-%d%s", "%s-%d%s",
updater.GetVersionedPath(filepath.Base(fileToUpgrade), currentVersion), filepath.Base(fileToUpgrade),
time.Now().UTC().Unix(), time.Now().UTC().Unix(),
upgradedSuffix, upgradedSuffix,
), ),