forked from TrueCloudLab/rclone
swift: make sensible error if the user forgets the container - fixes #1470
This commit is contained in:
parent
9a11d3efd9
commit
2ca477c57f
1 changed files with 7 additions and 0 deletions
|
@ -418,6 +418,10 @@ func (f *Fs) Mkdir(dir string) error {
|
||||||
if f.containerOK {
|
if f.containerOK {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
// if we are at the root, then it is OK
|
||||||
|
if f.container == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
// Check to see if container exists first
|
// Check to see if container exists first
|
||||||
_, _, err := f.c.Container(f.container)
|
_, _, err := f.c.Container(f.container)
|
||||||
if err == swift.ContainerNotFound {
|
if err == swift.ContainerNotFound {
|
||||||
|
@ -747,6 +751,9 @@ func (o *Object) updateChunks(in io.Reader, headers swift.Headers, size int64, c
|
||||||
//
|
//
|
||||||
// The new object may have been created if an error is returned
|
// The new object may have been created if an error is returned
|
||||||
func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error {
|
func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error {
|
||||||
|
if o.fs.container == "" {
|
||||||
|
return fs.FatalError(errors.New("container name needed in remote"))
|
||||||
|
}
|
||||||
err := o.fs.Mkdir("")
|
err := o.fs.Mkdir("")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue