s3: use lib/encoder

Co-authored-by: Nick Craig-Wood <nick@craig-wood.com>
This commit is contained in:
Fabian Möller
2019-09-30 22:00:24 +01:00
committed by Nick Craig-Wood
co-authored by Nick Craig-Wood
parent a8adce9c59
commit 33f129fbbc
4 changed files with 51 additions and 3 deletions
+17
View File
@@ -240,6 +240,23 @@ const FTP = encoder.MultiEncoder(
uint(Display) |
encoder.EncodeRightSpace)
// S3 is the encoding used by the s3 backend
//
// Any UTF-8 character is valid in a key, however it can't handle
// invalid UTF-8 and / have a special meaning.
//
// The SDK can't seem to handle uploading files called '.'
//
// FIXME would be nice to add
// - initial / encoding
// - doubled / encoding
// - trailing / encoding
// so that AWS keys are always valid file names
const S3 = encoder.MultiEncoder(
encoder.EncodeInvalidUtf8 |
encoder.EncodeSlash |
encoder.EncodeDot)
// ByName returns the encoder for a give backend name or nil
func ByName(name string) encoder.Encoder {
switch strings.ToLower(name) {
+1
View File
@@ -27,6 +27,7 @@ const (
OneDrive = Base
OpenDrive = Base
Pcloud = Base
S3 = Base
)
// ByName returns the encoder for a give backend name or nil