Skip to content

Commit

Permalink
Merge pull request #95 from jamebal/develop
Browse files Browse the repository at this point in the history
fix: 修复挂载目录下打开空文件夹然后返回上级失败的问题
  • Loading branch information
jamebal authored Jun 14, 2024
2 parents 7be6506 + 4cbff83 commit d62810e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
* @Description UploadApiParam
Expand Down Expand Up @@ -83,7 +84,7 @@ public class UploadApiParamDTO {
* 目录fileId
*/
String folder;

Map<String, Object> props;
/**
* 文件id
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ public ResponseResult<Object> listFiles(UploadApiParamDTO upload) throws CommonE
List<FileIntroVO> list = getFileDocuments(upload, criteria);
result.setData(list);
result.setCount(getFileDocumentsCount(upload, criteria));
if (upload.getProps() != null) {
result.setProps(upload.getProps());
}
return result;
}

Expand All @@ -170,7 +173,11 @@ private boolean checkMountParam(UploadApiParamDTO upload, String currentDirector
FileDocument fileDocument = getById(fileId);
if (fileDocument != null) {
upload.setUserId(fileDocument.getUserId());
upload.setUsername(userService.getUserNameById(fileDocument.getUserId()));
Map<String, Object> props = new HashMap<>(2);
String username = userService.getUserNameById(fileDocument.getUserId());
props.put("fileUsername", username);
upload.setProps(props);
upload.setUsername(username);
upload.setCurrentDirectory(fileDocument.getPath() + fileDocument.getName());
upload.setFolder(null);
return true;
Expand Down Expand Up @@ -318,6 +325,12 @@ public ResponseResult<Object> searchFileAndOpenDir(UploadApiParamDTO upload, Str
if (fileDocument == null) {
return ResultUtil.error(ExceptionType.FILE_NOT_FIND);
}
if (!fileDocument.getUserId().equals(userLoginHolder.getUserId())) {
Map<String, Object> props = new HashMap<>(2);
String username = userService.getUserNameById(fileDocument.getUserId());
props.put("fileUsername", username);
result.setProps(props);
}
String currentDirectory = getUserDirectory(fileDocument.getPath() + fileDocument.getName());

// 判断是否为ossPath
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/jmal/clouddisk/util/ResponseResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.Map;

/**
* ResponseResult
*
Expand All @@ -17,4 +19,5 @@ public class ResponseResult<T> {
private Object message;
private T data;
private Object count;
private Map<String, Object> props;
}

0 comments on commit d62810e

Please sign in to comment.