1
0
mirror of https://github.com/rclone/rclone.git synced 2025-01-13 20:38:12 +02:00

hubic: fix uploads - fixes #2524

Uploads were broken because chunk size was set to zero.  This was a
consequence of the backend config re-organization which meant that
chunk size had lost its default.

Sharing some backend config between swift and hubic fixes the problem
and means hubic gains its own --hubic-chunk-size flag.
This commit is contained in:
Nick Craig-Wood 2018-09-04 20:27:48 +01:00
parent 89be5cadaa
commit c644241392
2 changed files with 13 additions and 10 deletions

View File

@ -60,13 +60,13 @@ func init() {
log.Fatalf("Failed to configure token: %v", err) log.Fatalf("Failed to configure token: %v", err)
} }
}, },
Options: []fs.Option{{ Options: append([]fs.Option{{
Name: config.ConfigClientID, Name: config.ConfigClientID,
Help: "Hubic Client Id\nLeave blank normally.", Help: "Hubic Client Id\nLeave blank normally.",
}, { }, {
Name: config.ConfigClientSecret, Name: config.ConfigClientSecret,
Help: "Hubic Client Secret\nLeave blank normally.", Help: "Hubic Client Secret\nLeave blank normally.",
}}, }}, swift.SharedOptions...),
}) })
} }

View File

@ -31,13 +31,21 @@ const (
listChunks = 1000 // chunk size to read directory listings listChunks = 1000 // chunk size to read directory listings
) )
// SharedOptions are shared between swift and hubic
var SharedOptions = []fs.Option{{
Name: "chunk_size",
Help: "Above this size files will be chunked into a _segments container.",
Default: fs.SizeSuffix(5 * 1024 * 1024 * 1024),
Advanced: true,
}}
// Register with Fs // Register with Fs
func init() { func init() {
fs.Register(&fs.RegInfo{ fs.Register(&fs.RegInfo{
Name: "swift", Name: "swift",
Description: "Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)", Description: "Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)",
NewFs: NewFs, NewFs: NewFs,
Options: []fs.Option{{ Options: append([]fs.Option{{
Name: "env_auth", Name: "env_auth",
Help: "Get swift credentials from environment variables in standard OpenStack form.", Help: "Get swift credentials from environment variables in standard OpenStack form.",
Default: false, Default: false,
@ -134,12 +142,7 @@ func init() {
Help: "OVH Public Cloud Archive", Help: "OVH Public Cloud Archive",
Value: "pca", Value: "pca",
}}, }},
}, { }}, SharedOptions...),
Name: "chunk_size",
Help: "Above this size files will be chunked into a _segments container.",
Default: fs.SizeSuffix(5 * 1024 * 1024 * 1024),
Advanced: true,
}},
}) })
} }
@ -291,7 +294,7 @@ func swiftConnection(opt *Options, name string) (*swift.Connection, error) {
return c, nil return c, nil
} }
// NewFsWithConnection contstructs an Fs from the path, container:path // NewFsWithConnection constructs an Fs from the path, container:path
// and authenticated connection. // and authenticated connection.
// //
// if noCheckContainer is set then the Fs won't check the container // if noCheckContainer is set then the Fs won't check the container