mirror of
https://github.com/dataease/dataease.git
synced 2026-05-19 10:18:11 +08:00
fix: 修复下载远程Excel文件失败
This commit is contained in:
@@ -376,6 +376,13 @@ public class HttpClientUtil {
|
||||
// 设置请求头
|
||||
config.getHeader().forEach(httpGet::addHeader);
|
||||
HttpResponse response = httpClient.execute(httpGet);
|
||||
if (response.getStatusLine().getStatusCode() >= 400) {
|
||||
String msg = EntityUtils.toString(response.getEntity(), config.getCharset());
|
||||
if (StringUtils.isEmpty(msg)) {
|
||||
msg = "StatusCode: " + response.getStatusLine().getStatusCode();
|
||||
}
|
||||
throw new Exception(msg);
|
||||
}
|
||||
String fileName = extractFileName(response, url);
|
||||
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
String tranName = UUID.randomUUID().toString() + "." + suffix;
|
||||
|
||||
Reference in New Issue
Block a user