mirror of
https://gitee.com/novel_dev_team/novel-plus
synced 2026-07-20 17:54:59 +08:00
修复网路图片保存时文件损坏的情况
This commit is contained in:
@@ -10,6 +10,7 @@ import org.springframework.http.HttpHeaders;
|
|||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -48,6 +49,11 @@ public class FileUtil {
|
|||||||
out.write(b, 0, n);
|
out.write(b, 0, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.flush();
|
||||||
|
if( ImageIO.read(picFile) == null){
|
||||||
|
picSrc = "/images/default.gif";
|
||||||
|
}
|
||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.getMessage(),e);
|
log.error(e.getMessage(),e);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user