`URLEncoder.encode` will encode this as `/foo%2Bbar:+baz.txt`, but the correct encoding is actually `/foo+bar:%20baz.txt`. You need to use `UriEncoding.encodePathSegment` instead.