Skip to content
Snippets Groups Projects
Commit c4cc52a7 authored by Dean's avatar Dean
Browse files

version 1.6.3: fix swapped temp and storage directories

parent 818f6ac8
No related branches found
No related tags found
No related merge requests found
......@@ -155,7 +155,7 @@ func UploadPomf(associateObjectsWithUser bool) func(http.ResponseWriter, *http.R
// Write file to MD5 and to temp file
hash := md5.New()
tempPath := filepath.Join(viper.GetString("pomf.storageLocation"), key+ext)
tempPath := filepath.Join(viper.GetString("pomf.tempLocation"), key+ext)
tempFile, err := os.Create(tempPath)
if err != nil {
log.Error().Err(err).Msg("failed to create destination file")
......@@ -192,8 +192,16 @@ func UploadPomf(associateObjectsWithUser bool) func(http.ResponseWriter, *http.R
}
// Move file to the destination
destPath := filepath.Join(viper.GetString("pomf.tempLocation"), key+ext)
destPath := filepath.Join(viper.GetString("pomf.storageLocation"), key+ext)
err = os.Rename(tempPath, destPath)
if err != nil {
log.Error().Err(err).Msg("failed to move file to the destination")
err = os.Remove(tempPath)
if err != nil {
log.Error().Err(err).Msg("failed to delete temporary file after error")
}
panic(apierrors.InternalServerError)
}
// Get MD5 hash digest
md5Hash := hex.EncodeToString(hash.Sum(nil))
......
......@@ -26,7 +26,7 @@ import (
const (
configLocationUnix = "/etc/whats-this/api/config.toml"
shutdownTimeout = 10 * time.Second
version = "1.6.1"
version = "1.6.3"
)
// printConfiguration iterates through a configuration map[string]interface{}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment