1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-05 18:13:17 +00:00

config: fix problem reading pasted tokens over 4095 bytes

Before this change we were reading input from stdin using the terminal
in the default line mode which has a limit of 4095 characters.

The typical culprit was onedrive tokens (which are very long) giving the error

    Couldn't decode response: invalid character 'e' looking for beginning of value

This change swaps over to use the github.com/peterh/liner read line
library which does not have that limitation and also enables more
sensible cursor editing.

Fixes #8688 #8323 #5835
This commit is contained in:
Nick Craig-Wood
2025-08-13 15:26:48 +01:00
parent 8d878d0a5f
commit b0b3b04b3b
6 changed files with 32 additions and 23 deletions

View File

@@ -85,9 +85,9 @@ func testConfigFile(t *testing.T, options []fs.Option, configFileName string) fu
// makeReadLine makes a simple readLine which returns a fixed list of
// strings
func makeReadLine(answers []string) func() string {
func makeReadLine(answers []string) func(string) string {
i := 0
return func() string {
return func(string) string {
i++
return answers[i-1]
}