dropbox / dropbox/dropbox-sdk-java

SDK doesn't handle Unicode control characters.

未关闭
#490 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Java
星标
627
派生
463
平均合并
5 分钟
30 天内合并 PR
10

描述

Basically I have a code that does this:

```
private final DbxUserFilesRequests files;

@SneakyThrows
public Metadata getMetadata(String path) {
return files.getMetadata(path);
}
```
This works for normal paths that don't contain control characters.

However, if you supply path that contains the Unicode Control Characters that aren't escaped:
```
/SomeFolder/acces
s_token.txt
```

It spits out this issue:
```
java.lang.IllegalArgumentException: String 'path' does not match pattern
at com.dropbox.core.v2.files.GetMetadataArg.(GetMetadataArg.java:58)
at com.dropbox.core.v2.files.GetMetadataArg.(GetMetadataArg.java:80)
at com.dropbox.core.v2.files.DbxUserFilesRequests.getMetadata(DbxUserFilesRequests.java:1602)
```

But if you escape the path from unicode characters like this:
```
acces\u2028s_token.txt
```
It seems that the library escapes the backslash character, and causes the API to return the Malformed path response.
```
"error": {
".tag": "path",
"path": {
".tag": "malformed_path"
}
}
```

Unfortunately, I don't really have a choice in renaming the file. Is there a solution we can have to handle the unicode control? Like another method that allows us to supply a string that won't be processed by the SDK?

I know from cURL, it's possible to use the escaped form of the unicode character and get the metadata. However, it's just not a choice I have from the java SDK since it won't do it for me, and it doesn't like the escaped version of unicode.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。