Skip to content

Commit

Permalink
:bug:binarywang#1500 企业微信素材下载生成文件名时,提供默认的时间戳。防止Prefix string too shor…
Browse files Browse the repository at this point in the history
…t异常。
  • Loading branch information
BeHappyWsz committed Apr 13, 2020
1 parent 23c1b0b commit 345230b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ public File execute(String uri, String queryParam, WxType wxType) throws WxError
fileName = String.valueOf(System.currentTimeMillis());
}

return FileUtils.createTmpFile(inputStream, FilenameUtils.getBaseName(fileName), FilenameUtils.getExtension(fileName),
String baseName = FilenameUtils.getBaseName(fileName);
if (StringUtils.isBlank(fileName) || baseName.length() < 3) {
baseName = String.valueOf(System.currentTimeMillis());
}

return FileUtils.createTmpFile(inputStream, baseName, FilenameUtils.getExtension(fileName),
super.tmpDirFile);

} finally {
Expand Down

0 comments on commit 345230b

Please sign in to comment.