diff --git a/.github/workflows/assets.yml b/.github/workflows/assets.yml index 7b88e95fd1e329d14c32304fc04b82210f5ae2ff..f4c4d55599b7276226737dc20e2471646438a431 100644 --- a/.github/workflows/assets.yml +++ b/.github/workflows/assets.yml @@ -14,7 +14,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: '1.17.x' + go-version: '1.18.x' - name: Install run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8efe0be838195cda0652c6e4237d809b241977f..3f6682b6ffebb2cb53e47f16c846df2a17b16237 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: matrix: include: # Recommended version - - go-version: 1.17.x + - go-version: 1.18.x couchdb-version: 2.3.1 lint: true # More exotic version diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 8c560fa6734f0ad9dd65380f12cfc311f7590f37..f330c5596fcb8c07d4a214b39e9eeadf17cb44e5 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -14,7 +14,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: '1.17.x' + go-version: '1.18.x' - name: Install run: | echo "$(go env GOPATH)/bin" >> $GITHUB_PATH diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 17516bea25d5d2a0e050e7a0d967c6fbc9d9fbab..66a233cf408a127e1babce9086fa878e092d664b 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -38,7 +38,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: '1.17.x' + go-version: '1.18.x' - name: Install Ruby uses: actions/setup-ruby@v1 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index deb4aade51cbf445346291ed0faefa0c267f0f8f..3bc65670103ed4549f13c1f5781a3c12fb31ccb8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.17 + go-version: 1.18 - name: Check code uses: actions/checkout@v3 - name: Build the binaries diff --git a/docs/docker.md b/docs/docker.md index 0fa7c0205d63e8858e2fbced2ea13a42cd845d07..6633f227f2c6d0a32c84472bd8dab348cc7155a8 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -36,7 +36,7 @@ docker run -it --rm --name cozy-stack \ --workdir /app \ -v $(pwd):/app \ -v $(pwd):/go/bin \ - golang:1.17 \ + golang:1.18 \ go get -v github.com/cozy/cozy-stack ``` diff --git a/go.mod b/go.mod index dd91bb624cd104980d387fb6524261525658f32b..f0611403b3763f9ed97525cfafdb95d3ba08bc6f 100644 --- a/go.mod +++ b/go.mod @@ -51,6 +51,7 @@ require ( golang.org/x/net v0.0.0-20220225172249-27dd8689420f golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a golang.org/x/sync v0.0.0-20210220032951-036812b2e83c + golang.org/x/text v0.3.7 gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect ) diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index ba00d1d5cf8902493139d198398b82e711c6d648..d94508dc467f9195347964faf8d811c541680eac 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "io/ioutil" - "net" "net/http" "net/url" "path" @@ -492,14 +491,7 @@ func fetch(client *http.Client, registry, ref *url.URL, cache CacheControl) (res start := time.Now() resp, err = client.Do(req) if err != nil { - // Try again for temporary errors - start = time.Now() - if ne, ok := err.(net.Error); ok && ne.Temporary() { - resp, err = client.Do(req) - } - if err != nil { - return - } + return } elapsed := time.Since(start) defer func() { diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 41aef5dd9c7d1519f3b09e418388a268dbd54284..98ef536201a9d4073df158be68f884fea51e80a2 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -4,7 +4,7 @@ # Multi-stage image: this step builds cozy-stack (and mailhog) -FROM golang:1.17 as build +FROM golang:1.18 as build WORKDIR /app # MailHog diff --git a/web/bitwarden/ciphers.go b/web/bitwarden/ciphers.go index a2c8a9a4bc6328f86840c4810543a11233d6779e..5d9a648deb0319c350e69eadc786826f3a20f6bf 100644 --- a/web/bitwarden/ciphers.go +++ b/web/bitwarden/ciphers.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "net/http" - "strings" "time" "github.com/cozy/cozy-stack/model/bitwarden" @@ -135,11 +134,14 @@ type cipherResponse struct { func titleizeKeys(data bitwarden.MapData) map[string]interface{} { res := make(map[string]interface{}) for k, v := range data { - key := strings.Title(k) if k == "ssn" { - key = "SSN" + k = "SSN" } - res[key] = v + key := []byte(k[:]) + if 'a' <= key[0] && key[0] <= 'z' { + key[0] -= 'a' - 'A' + } + res[string(key)] = v } return res } diff --git a/worker/exec/konnector.go b/worker/exec/konnector.go index a9074c2860c31a0cd80e0ee56be8e4058c62ebef..0cf1acf9b6f918bc486fc6c703e144ff00621ba2 100644 --- a/worker/exec/konnector.go +++ b/worker/exec/konnector.go @@ -27,6 +27,8 @@ import ( "github.com/cozy/cozy-stack/pkg/realtime" "github.com/cozy/cozy-stack/pkg/registry" "github.com/spf13/afero" + "golang.org/x/text/cases" + "golang.org/x/text/language" ) const ( @@ -381,7 +383,8 @@ func computeFolderPath(inst *instance.Instance, slug string, acc *account.Accoun "_", "%", "_", ".", "_", "'", "_", "\"", "_", ":", "_", "*", "_", "?", "_", "<", "_", ">", "_", "{", "_", "}", "_") accountName := r.Replace(acc.Name) - return fmt.Sprintf("/%s/%s/%s", admin, strings.Title(slug), accountName) + title := cases.Title(language.Make(inst.Locale)).String(slug) + return fmt.Sprintf("/%s/%s/%s", admin, title, accountName) } // ensurePermissions checks that the konnector has the permissions to write