Skip to content

Commit

Permalink
azureblob: fix permission error on SAS URL limited to container
Browse files Browse the repository at this point in the history
Before this change, for some operations, eg rcat or copyto (of a file)
rclone would attempt to create the container when using a SAS URL
limited to a container.

After this change we assume the container does not need creating when
using a container SAS URL.

See: https://forum.rclone.org/t/rclone-rcat-azure-blob-container-sas-token-403-error/16286
  • Loading branch information
ncw committed May 13, 2020
1 parent e91b509 commit d342f9f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/azureblob/azureblob.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,10 @@ func (f *Fs) Mkdir(ctx context.Context, dir string) error {
// makeContainer creates the container if it doesn't exist
func (f *Fs) makeContainer(ctx context.Context, container string) error {
return f.cache.Create(container, func() error {
// If this is a SAS URL limited to a container then assume it is already created
if f.isLimited {
return nil
}
// now try to create the container
return f.pacer.Call(func() (bool, error) {
_, err := f.cntURL(container).Create(ctx, azblob.Metadata{}, azblob.PublicAccessNone)
Expand Down

0 comments on commit d342f9f

Please sign in to comment.