azure: Strip ? prefix from sas token

This commit is contained in:
Michael Eischer 2022-07-16 23:45:41 +02:00
parent 64a7ec5341
commit 5639c41b6a
2 changed files with 6 additions and 5 deletions

View file

@ -57,7 +57,12 @@ func open(cfg Config, rt http.RoundTripper) (*Backend, error) {
// we (as per the SDK ) assume the default Azure portal.
url := fmt.Sprintf("https://%s.blob.core.windows.net/", cfg.AccountName)
debug.Log(" - using sas token")
client, err = storage.NewAccountSASClientFromEndpointToken(url, cfg.AccountSAS.Unwrap())
sas := cfg.AccountSAS.Unwrap()
// strip query sign prefix
if sas[0] == '?' {
sas = sas[1:]
}
client, err = storage.NewAccountSASClientFromEndpointToken(url, sas)
if err != nil {
return nil, errors.Wrap(err, "NewAccountSASClientFromEndpointToken")
}