mirror of
https://code.tvl.fyi/depot.git:/tools/nixery.git
synced 2025-03-14 21:51:52 +00:00
fix(server): Ensure paths exist when renaming in filesystem storage
The point at which files are moved happens to also (initially) be the point where the `layers` directory is created. For this reason renaming must ensure that all path components exist, which this commit takes care of.
This commit is contained in:
parent
2b57c51d59
commit
68b89273c2
|
@ -59,7 +59,13 @@ func (b *FSBackend) Fetch(key string) (io.ReadCloser, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *FSBackend) Move(old, new string) error {
|
func (b *FSBackend) Move(old, new string) error {
|
||||||
return os.Rename(path.Join(b.path, old), path.Join(b.path, new))
|
newpath := path.Join(b.path, new)
|
||||||
|
err := os.MkdirAll(path.Dir(newpath), 0755)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return os.Rename(path.Join(b.path, old), newpath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *FSBackend) ServeLayer(digest string, w http.ResponseWriter) error {
|
func (b *FSBackend) ServeLayer(digest string, w http.ResponseWriter) error {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user