azure: Strip ? prefix from sas token
This commit is contained in:
parent
64a7ec5341
commit
5639c41b6a
2 changed files with 6 additions and 5 deletions
|
@ -506,10 +506,6 @@ or
|
|||
$ export AZURE_ACCOUNT_NAME=<ACCOUNT_NAME>
|
||||
$ export AZURE_ACCOUNT_SAS=<SAS_TOKEN>
|
||||
|
||||
With the later form, ensure your ``SAS_TOKEN`` does not start with a leading
|
||||
``?``. If the generated token starts with a leading ``?`` it is safe to just
|
||||
delete the first character (the ``?``) before use.
|
||||
|
||||
Afterwards you can initialize a repository in a container called ``foo`` in the
|
||||
root path like this:
|
||||
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue