This commit is contained in:
@@ -5,6 +5,7 @@ import com.vrt.fileprotection.FileProtector;
|
||||
import com.vrt.fileprotection.NoCopyCheckResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -285,6 +286,8 @@ public class ApiController {
|
||||
}
|
||||
}
|
||||
|
||||
@Value("${file.storage.base-path}")
|
||||
private String baseStoragePath;
|
||||
|
||||
@GetMapping("/v{version}/files/download/{fileId}")
|
||||
public ResponseEntity<?> downloadFile(
|
||||
@@ -337,7 +340,9 @@ public class ApiController {
|
||||
errorData));
|
||||
}
|
||||
|
||||
Path filePath = Paths.get(entityResponse.getProtectStatus());
|
||||
String fullPath = baseStoragePath + "/" + entityResponse.getProtectStatus();
|
||||
// Path filePath = Paths.get(entityResponse.getProtectStatus());
|
||||
Path filePath = Paths.get(fullPath);
|
||||
Resource resource = new UrlResource(filePath.toUri());
|
||||
|
||||
if (!resource.exists()) {
|
||||
|
||||
Reference in New Issue
Block a user