mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 15:43:21 +00:00
Prefix temporary file with object id
This commit is contained in:
parent
28f569c0df
commit
64a43228de
1 changed files with 3 additions and 2 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue