mirror of
https://github.com/restic/rest-server.git
synced 2026-09-26 05:51:24 -07:00
Prefix temporary file with object id
This commit is contained in:
+3
-2
@@ -553,7 +553,8 @@ func (h *Handler) saveBlob(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tf, err := ioutil.TempFile(filepath.Dir(path), ".rest-server-temp")
|
tmpFn := objectID + ".rest-server-temp"
|
||||||
|
tf, err := ioutil.TempFile(filepath.Dir(path), tmpFn)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
// the error is caused by a missing directory, create it and retry
|
// the error is caused by a missing directory, create it and retry
|
||||||
mkdirErr := os.MkdirAll(filepath.Dir(path), h.opt.DirMode)
|
mkdirErr := os.MkdirAll(filepath.Dir(path), h.opt.DirMode)
|
||||||
@@ -561,7 +562,7 @@ func (h *Handler) saveBlob(w http.ResponseWriter, r *http.Request) {
|
|||||||
log.Print(mkdirErr)
|
log.Print(mkdirErr)
|
||||||
} else {
|
} else {
|
||||||
// try again
|
// try again
|
||||||
tf, err = ioutil.TempFile(filepath.Dir(path), ".rest-server-temp")
|
tf, err = ioutil.TempFile(filepath.Dir(path), tmpFn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user