Remove path delimiters from downloading filename

This commit is contained in:
xhh
2016-01-11 22:13:07 +08:00
parent 3099aa2d85
commit 3c6639b4f6
2 changed files with 7 additions and 5 deletions

View File

@@ -724,8 +724,9 @@ public class ApiClient {
// Get filename from the Content-Disposition header.
Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
Matcher matcher = pattern.matcher(contentDisposition);
if (matcher.find())
filename = matcher.group(1);
if (matcher.find()) {
filename = matcher.group(1).replaceAll(".*[/\\\\]", "");
}
}
String prefix = null;