Skip to content

Commit 85e2e25

Browse files
authored
Merge pull request moby#4124 from jedevc/chore-refactor-filesync-encode
2 parents f47a9da + c02f99d commit 85e2e25

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

session/filesync/filesync.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,13 @@ func decodeOpts(opts map[string][]string) map[string][]string {
351351
md := make(map[string][]string, len(opts))
352352
for k, v := range opts {
353353
out := make([]string, len(v))
354-
var isDecoded bool
354+
var isEncoded bool
355355
if v, ok := opts[k+"-encoded"]; ok && len(v) > 0 {
356356
if b, _ := strconv.ParseBool(v[0]); b {
357-
isDecoded = true
357+
isEncoded = true
358358
}
359359
}
360-
if isDecoded {
360+
if isEncoded {
361361
for i, s := range v {
362362
out[i], _ = url.QueryUnescape(s)
363363
}
@@ -373,13 +373,14 @@ func decodeOpts(opts map[string][]string) map[string][]string {
373373
// is backwards compatible and avoids encoding ASCII characters.
374374
func encodeStringForHeader(inputs []string) ([]string, bool) {
375375
var encode bool
376+
loop:
376377
for _, input := range inputs {
377378
for _, runeVal := range input {
378379
// Only encode non-ASCII characters, and characters that have special
379380
// meaning during decoding.
380381
if runeVal > unicode.MaxASCII {
381382
encode = true
382-
break
383+
break loop
383384
}
384385
}
385386
}

0 commit comments

Comments
 (0)