• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / deployments / 1197570064

01 Mar 2024 06:24PM UTC coverage: 52.222% (-28.4%) from 80.645%
1197570064

Pull #998

gitlab-ci

web-flow
chore: bump github.com/Azure/azure-sdk-for-go/sdk/azcore

Bumps [github.com/Azure/azure-sdk-for-go/sdk/azcore](https://github.com/Azure/azure-sdk-for-go) from 1.9.1 to 1.10.0.
- [Release notes](https://github.com/Azure/azure-sdk-for-go/releases)
- [Changelog](https://github.com/Azure/azure-sdk-for-go/blob/main/documentation/release.md)
- [Commits](https://github.com/Azure/azure-sdk-for-go/compare/sdk/azcore/v1.9.1...sdk/azcore/v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/Azure/azure-sdk-for-go/sdk/azcore
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #998: chore: bump github.com/Azure/azure-sdk-for-go/sdk/azcore from 1.9.1 to 1.10.0

5218 of 9992 relevant lines covered (52.22%)

0.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/storage/azblob/signature.go
1
// Copyright 2023 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
package azblob
16

17
import (
18
        "context"
19
        "errors"
20
        "net/url"
21
        "strings"
22

23
        "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
24

25
        "github.com/mendersoftware/deployments/storage"
26
)
27

28
var (
29
        ErrConnStrNoName = errors.New("connection string does not contain an account name")
30
        ErrConnStrNoKey  = errors.New("connection string does not contain an account key")
31
)
32

33
func (c *client) signParamsFromContext(
34
        ctx context.Context,
35
) (creds *azblob.SharedKeyCredential, proxyURL *url.URL, err error) {
×
36
        creds = c.credentials
×
37
        proxyURL = c.proxyURL
×
38
        if settings, _ := storage.SettingsFromContext(ctx); settings != nil {
×
39
                if settings.ConnectionString != nil {
×
40
                        creds, err = keyFromConnString(*settings.ConnectionString)
×
41
                } else {
×
42
                        creds, err = azblob.NewSharedKeyCredential(settings.Key, settings.Secret)
×
43
                }
×
44
                if err == nil && settings.ProxyURI != nil {
×
45
                        proxyURL, err = url.Parse(*settings.ProxyURI)
×
46
                }
×
47
        }
48
        return creds, proxyURL, err
×
49
}
50

51
func connStringAttr(cs, key string) (string, bool) {
×
52
        var start, end int
×
53
        for {
×
54
                i := strings.Index(cs[start:], key)
×
55
                if i < 0 {
×
56
                        return "", false
×
57
                }
×
58
                start += i
×
59
                if i == 0 || cs[start-1] == ';' {
×
60
                        break
×
61
                }
62
                start += len(key)
×
63
        }
64
        start += len(key)
×
65
        i := strings.IndexRune(cs[start:], ';')
×
66
        if i < 0 {
×
67
                // cs ends with value
×
68
                end = len(cs)
×
69
        } else {
×
70
                end = start + i
×
71
        }
×
72
        return cs[start:end], true
×
73
}
74

75
func keyFromConnString(cs string) (*azblob.SharedKeyCredential, error) {
×
76
        const (
×
77
                attrName = "AccountName="
×
78
                attrKey  = "AccountKey="
×
79
        )
×
80
        var (
×
81
                accountName, accountKey string
×
82
                ok                      bool
×
83
        )
×
84
        if accountName, ok = connStringAttr(cs, attrName); !ok {
×
85
                return nil, ErrConnStrNoName
×
86
        }
×
87
        if accountKey, ok = connStringAttr(cs, attrKey); !ok {
×
88
                return nil, ErrConnStrNoKey
×
89
        }
×
90
        return azblob.NewSharedKeyCredential(accountName, accountKey)
×
91
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc