gcs: fix directory marker code #3453

Use Update to upload the directory markers
This commit is contained in:
Nick Craig-Wood 2023-04-28 17:23:37 +01:00
parent baf16a65f0
commit 4023eaebe0

View File

@ -898,6 +898,7 @@ func (f *Fs) createDirectoryMarker(ctx context.Context, bucket, dir string) erro
// Object to be uploaded
o := &Object{
fs: f,
modTime: time.Now(),
}
for {
@ -917,7 +918,7 @@ func (f *Fs) createDirectoryMarker(ctx context.Context, bucket, dir string) erro
// Upload it if not
fs.Debugf(o, "Creating directory marker")
content := io.Reader(strings.NewReader(""))
_, err = f.Put(ctx, content, o)
err = o.Update(ctx, content, o)
if err != nil {
return fmt.Errorf("creating directory marker failed: %w", err)
}