-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
...components/io-component/src/main/java/org/jetlinks/community/io/file/ClusterFileManager.java
Show resolved
Hide resolved
@@ -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); |
There was a problem hiding this comment.
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("/")) { |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该需要对应管理权限@QueryAction
?否则登录后就能查看全部文件?
1 增加查询文件夹下所有文件的接口
2 存储文件时候增加指定文件夹
3 重构删除文件事件监听的代码