Skip to content

Instantly share code, notes, and snippets.

@legionus
Created July 25, 2018 16:05
Show Gist options
  • Save legionus/8498f82a55fa0d9e23f44065cc5f207c to your computer and use it in GitHub Desktop.
Save legionus/8498f82a55fa0d9e23f44065cc5f207c to your computer and use it in GitHub Desktop.
diff --git a/vendor/github.com/docker/distribution/registry/storage/driver/swift/swift.go b/vendor/github.com/docker/distribution/registry/storage/driver/swift/swift.go
index 4b7aa4e9f2..27f15bfd25 100644
--- a/vendor/github.com/docker/distribution/registry/storage/driver/swift/swift.go
+++ b/vendor/github.com/docker/distribution/registry/storage/driver/swift/swift.go
@@ -31,6 +31,7 @@ import (
"strings"
"time"
+ "github.com/coreos/go-semver/semver"
"github.com/mitchellh/mapstructure"
"github.com/ncw/swift"
@@ -223,7 +224,13 @@ func New(params Parameters) (*Driver, error) {
_, d.BulkDeleteSupport = config["bulk_delete"]
if err := mapstructure.Decode(config, &info); err == nil {
- d.TempURLContainerKey = info.Swift.Version >= "2.3.0"
+ featureVersion, featureErr := semver.NewVersion("2.3.0")
+ currentVersion, currentErr := semver.NewVersion(info.Swift.Version)
+ if featureErr == nil && currentErr == nil {
+ d.TempURLContainerKey = !currentVersion.LessThan(*featureVersion)
+ } else {
+ d.TempURLContainerKey = params.TempURLContainerKey
+ }
d.TempURLMethods = info.Tempurl.Methods
if d.BulkDeleteSupport {
d.BulkDeleteMaxDeletes = info.BulkDelete.MaxDeletesPerRequest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment