diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java index ffba6c7..68d80a2 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/file/impl/FileServiceImpl.java @@ -252,7 +252,7 @@ public class FileServiceImpl extends AbstractService implements IFileService { */ private void setRangeHeader(long startRange, long endRange, HttpServletResponse response, String fileId, long contentLength) { // 这里不设置,会出现第一次加载很慢的情况 - response.setHeader("Content-Length", String.valueOf(contentLength - startRange)); + response.setHeader("Content-Length", String.valueOf(endRange - startRange + 1)); response.setHeader("Content-Range", String.format("bytes %d-%d/%d", startRange, endRange, contentLength)); response.setHeader("Accept-Ranges", "bytes"); response.setHeader("Etag", fileId);