diff --git a/server/pom.xml b/server/pom.xml
index 72a1941a..485f0424 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -28,6 +28,17 @@
org.springframework.boot
spring-boot-starter-freemarker
+
+
+ net.sf.sevenzipjbinding
+ sevenzipjbinding
+ 16.02-2.01
+
+
+ net.sf.sevenzipjbinding
+ sevenzipjbinding-all-platforms
+ 16.02-2.01
+
org.springframework.boot
spring-boot-starter-web
diff --git a/server/src/main/java/cn/keking/model/FileAttribute.java b/server/src/main/java/cn/keking/model/FileAttribute.java
index 036bef9a..6ba903b7 100644
--- a/server/src/main/java/cn/keking/model/FileAttribute.java
+++ b/server/src/main/java/cn/keking/model/FileAttribute.java
@@ -15,6 +15,7 @@ public class FileAttribute {
private String fileKey;
private String officePreviewType = ConfigConstants.getOfficePreviewType();
private String tifPreviewType;
+ private Boolean skipDownLoad = false;
public FileAttribute() {
}
@@ -34,15 +35,6 @@ public class FileAttribute {
this.officePreviewType = officePreviewType;
}
- public FileAttribute(FileType type, String suffix, String name, String url, String officePreviewType, String tifPreviewType) {
- this.type = type;
- this.suffix = suffix;
- this.name = name;
- this.url = url;
- this.officePreviewType = officePreviewType;
- this.tifPreviewType = tifPreviewType;
- }
-
public String getFileKey() {
return fileKey;
}
@@ -90,7 +82,13 @@ public class FileAttribute {
public void setUrl(String url) {
this.url = url;
}
+ public Boolean getSkipDownLoad() {
+ return skipDownLoad;
+ }
+ public void setSkipDownLoad(Boolean skipDownLoad) {
+ this.skipDownLoad = skipDownLoad;
+ }
public String getTifPreviewType() {
return tifPreviewType;
}
@@ -98,5 +96,4 @@ public class FileAttribute {
public void setTifPreviewType(String previewType) {
this.tifPreviewType = previewType;
}
-
}
diff --git a/server/src/main/java/cn/keking/service/CompressFileReader.java b/server/src/main/java/cn/keking/service/CompressFileReader.java
index c11e5909..e73751a5 100644
--- a/server/src/main/java/cn/keking/service/CompressFileReader.java
+++ b/server/src/main/java/cn/keking/service/CompressFileReader.java
@@ -2,6 +2,7 @@ package cn.keking.service;
import cn.keking.config.ConfigConstants;
import cn.keking.model.FileType;
+import cn.keking.utils.FileHeaderRar;
import cn.keking.utils.KkFileUtils;
import cn.keking.web.filter.BaseUrlFilter;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -9,10 +10,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.junrar.Archive;
import com.github.junrar.exception.RarException;
import com.github.junrar.rarfile.FileHeader;
+import net.sf.sevenzipjbinding.*;
+import net.sf.sevenzipjbinding.impl.RandomAccessFileInStream;
+import net.sf.sevenzipjbinding.simple.ISimpleInArchive;
import org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry;
import org.apache.commons.compress.archivers.sevenz.SevenZFile;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
+import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Component;
import java.io.*;
@@ -24,6 +29,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
/**
* @author yudian-it
@@ -99,44 +105,84 @@ public class CompressFileReader {
List imgUrls = new ArrayList<>();
String baseUrl = BaseUrlFilter.getBaseUrl();
try {
- Archive archive = new Archive(new FileInputStream(filePath));
- List headers = archive.getFileHeaders();
- headers = sortedHeaders(headers);
+ List items = getRar4Paths(filePath);
String archiveFileName = fileHandlerService.getFileNameFromPath(filePath);
- List