Skip to content

Commit

Permalink
Merge pull request #59 from jamebal/chore
Browse files Browse the repository at this point in the history
perf: 添加非分享界面下的文件夹下载
  • Loading branch information
jamebal authored May 24, 2024
2 parents 398a7c1 + dbcaf1e commit 428cedd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;

/**
* @Description share
Expand Down Expand Up @@ -152,6 +149,18 @@ public void publicPackageDownload(HttpServletRequest request, HttpServletRespons
}
}

@Operation(summary = "打包下载")
@GetMapping("/public/s/{fileId}/packageDownload/{filename}")
@LogOperatingFun(logType = LogOperation.Type.BROWSE)
public void publicPackageDownloadOne(HttpServletRequest request, HttpServletResponse response, @PathVariable String fileId, @PathVariable String filename) {
FileDocument fileDocument = fileService.getById(fileId);
if (fileInterceptor.isNotAllowAccess(fileDocument, request)) {
return;
}
List<String> fileIdList = Collections.singletonList(fileId);
fileService.publicPackageDownload(request, response, fileIdList);
}

@Operation(summary = "显示缩略图")
@GetMapping("/articles/s/view/thumbnail")
@LogOperatingFun(logType = LogOperation.Type.BROWSE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private boolean fileAuthError(HttpServletRequest request, HttpServletResponse re
private boolean validShareFile(HttpServletRequest request, Path uriPath, String shareKey) {
FileDocument fileDocument = fileService.getById(shareKey);
if (!isNotAllowAccess(fileDocument, request)) {
// 判断当前uri所属的文件是否为该分享的文件或其子文件
// 判断当前uri所属的文件是否为已分享的文件或其子文件
FileDocument thisFile = getFileDocument(uriPath);
if (thisFile.getPath().equals(fileDocument.getPath())) {
return false;
Expand Down

0 comments on commit 428cedd

Please sign in to comment.