Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(文件管理): 优化文件管理 #558

Closed
wants to merge 6 commits into from

Conversation

PengyuDeng
Copy link
Contributor

1 增加查询文件夹下所有文件的接口
2 存储文件时候增加指定文件夹
3 重构删除文件事件监听的代码

1 增加查询文件夹下所有文件的接口
2 存储文件时候增加指定文件夹
3 重构删除文件事件监听的代码
@@ -118,14 +118,12 @@ private DataBuffer updateDigest(MessageDigest digest, DataBuffer dataBuffer) {
return dataBuffer;
}

public Mono<FileInfo> doSaveFile(String name, Flux<DataBuffer> stream, FileOption... options) {
LocalDate now = LocalDate.now();
public Mono<FileInfo> doSaveFile(String name, String folder, Flux<DataBuffer> stream, FileOption... options) {
FileInfo fileInfo = new FileInfo();
fileInfo.setId(IDGenerator.MD5.generate());
fileInfo.withFileName(name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

校验folder合法性

@@ -168,6 +170,9 @@ public Mono<FileInfo> saveFile(String name, Flux<DataBuffer> stream, FileOption.

@Override
public Mono<FileInfo> saveFile(String name, String folder, Flux<DataBuffer> stream, FileOption... options) {
if (folder.contains("/")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不够严谨,文件路径的方式可能有很多,以及非法字符等。

@@ -106,6 +107,13 @@ public Mono<Void> read(@PathVariable String fileId,
}));
}

@GetMapping("/{folder}/_list")
@Authorize()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该需要对应管理权限@QueryAction?否则登录后就能查看全部文件?

@PengyuDeng PengyuDeng closed this Sep 25, 2024
@PengyuDeng PengyuDeng deleted the file branch September 25, 2024 07:16
@PengyuDeng PengyuDeng restored the file branch September 25, 2024 07:16
@PengyuDeng PengyuDeng deleted the file branch September 25, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants