Skip to content

Commit

Permalink
local: encode invalid UTF-8 on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ncw committed Jul 27, 2019
1 parent 87cdfe4 commit 257155e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/local/encode_other.go
@@ -1,4 +1,4 @@
//+build !windows
//+build !windows,!darwin

package local

Expand Down
10 changes: 10 additions & 0 deletions fs/encodings/encodings.go
Expand Up @@ -21,6 +21,13 @@ const Display = encoder.Standard
// LocalUnix is the encoding used by the local backend for non windows platforms
const LocalUnix = Base

// LocalMacOS is the encoding used by the local backend for macOS
//
// macOS can't store invalid UTF-8, it converts them into %XX encoding
const LocalMacOS = encoder.MultiEncoder(
uint(Base) |
encoder.EncodeInvalidUtf8)

// LocalWindows is the encoding used by the local backend for windows platforms
//
// List of replaced characters:
Expand Down Expand Up @@ -267,6 +274,8 @@ func ByName(name string) encoder.Encoder {
return LocalWindows
case "local-unix", "unix":
return LocalUnix
case "local-macos", "macos":
return LocalMacOS
case "mega":
return Mega
case "onedrive":
Expand Down Expand Up @@ -309,6 +318,7 @@ func Names() []string {
"koofr",
"local-unix",
"local-windows",
"local-macos",
"local",
"mega",
"onedrive",
Expand Down

0 comments on commit 257155e

Please sign in to comment.