Replace base32 with base64 for long filenames


#1

I have some very long names that when base32 encoded get stretched beyond the maximum allowed by B2. In looking at my data set 96% are below the 192-character long efficiency of base64 — it would fix the bulk of my problems. Base32 maxes out around 156.

I’m specifically talking about using

URLEncoding is the alternate base64 encoding defined in RFC 4648. It is typically used in URLs and file names.

var URLEncoding = NewEncoding(encodeURL)

from package base64 here.

The alternate RFC4648 encoding will prevent the disallowed backslash character from being used.

I’m specifically talking about modifying func encodeFileName() and func decodeFileName() from backend/crypt/cipher.go.

Do you think this will work and am I approximately on the right track?

Thanks

P.S. I barely have any idea what I’m talking about.
P.P.S. I have seen “base32 is used rather than the more efficient base64 so rclone can be used on case insensitive remotes (eg Windows, Amazon Drive).” from here, but B2 is not a case insensitive remote!


#2

That is the reason rclone uses base32. It would be annoying if you couldn’t copy your crypt you made on Onedrive to Google drive for instance.

If you want more efficiency there is also base85

I expect it will work! Would you plan to contribute this to rclone? It could be an option easily enough.