Compare commits

..

3 Commits
url ... log

Author SHA1 Message Date
kl
a2eef41ec7 加回漏掉的pdfjs 2020-12-28 11:21:53 +08:00
kl
60da610d1f 增强url base64解码失败时的提示信息 2020-12-28 11:13:53 +08:00
kl
08415aa5ca 修复发行包运行时找不到日志目录的问题 2020-12-28 11:11:51 +08:00
2 changed files with 3 additions and 10 deletions

View File

@ -201,12 +201,6 @@
<scope>system</scope>
<systemPath>${basedir}/lib/cpdetector-1.04.jar</systemPath>
</dependency>
<!-- url 规范化 -->
<dependency>
<groupId>io.mola.galimatias</groupId>
<artifactId>galimatias</artifactId>
<version>0.2.1</version>
</dependency>
</dependencies>
<build>
<resources>

View File

@ -4,7 +4,6 @@ import cn.keking.config.ConfigConstants;
import cn.keking.model.FileAttribute;
import cn.keking.model.FileType;
import cn.keking.model.ReturnResponse;
import io.mola.galimatias.GalimatiasParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -82,6 +81,7 @@ public class DownloadUtils {
public static byte[] getBytesFromUrl(String urlStr) throws IOException {
InputStream is = getInputStreamFromUrl(urlStr);
if (is == null) {
// urlStr = URLUtil.normalize(urlStr, true, true);
is = getInputStreamFromUrl(urlStr);
if (is == null) {
logger.error("文件下载异常url{}", urlStr);
@ -98,14 +98,13 @@ public class DownloadUtils {
private static InputStream getInputStreamFromUrl(String urlStr) {
try {
URL url = io.mola.galimatias.URL.parse(urlStr).toJavaURL();
URL url = new URL(urlStr);
URLConnection connection = url.openConnection();
if (connection instanceof HttpURLConnection) {
connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
}
return connection.getInputStream();
} catch (IOException | GalimatiasParseException e) {
} catch (IOException e) {
logger.warn("连接url异常url{}", urlStr);
return null;
}