Compare commits

...

7 Commits

Author SHA1 Message Date
dependabot[bot]
825b72c9ff ⬆️ Bump org.apache.poi:poi-ooxml from 5.2.5 to 5.4.0
Bumps org.apache.poi:poi-ooxml from 5.2.5 to 5.4.0.

---
updated-dependencies:
- dependency-name: org.apache.poi:poi-ooxml
  dependency-version: 5.4.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-10 15:25:54 +00:00
zhaojun
6d8bdf1df3 修改配置避免创建 issue 失败 2025-04-10 12:06:03 +08:00
zhaojun
0173357ec9 增加 bug report 配置,避免创建 issue 失败 2025-04-10 12:03:52 +08:00
zhaojun
b4ae4bcc90 修复用 OnlyOffice 预览过某个文件后,删除或重新上传本地修改过的文件时,仍然看到旧版本的 bug 2025-04-10 12:02:13 +08:00
zhaojun
f7679217ec 修复用 OnlyOffice 预览过某个文件后,删除或重新上传本地修改过的文件时,仍然看到旧版本的 bug 2025-04-08 22:41:32 +08:00
zhaojun
901d539332 修正 README 未居中的问题 2025-04-07 19:29:35 +08:00
zhaojun
1b3c284f4e 修改 README 描述、图片为最新版内容。 2025-04-07 19:07:30 +08:00
23 changed files with 226 additions and 60 deletions

13
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: 'Blank Issue'
description: 请使用 https://issue.zfile.vip 创建新的问题.
body:
- type: markdown
attributes:
value: |
**注意:**
不要通过此页面创建问题, 请使用 https://issue.zfile.vip 创建新的问题.
如果不是通过此链接创建的问题, 将会被直接关闭.
- type: textarea
id: add-a-description
attributes:
label: Add a description

View File

@@ -1,4 +1,4 @@
blank_issues_enabled: false
blank_issues_enabled: true
contact_links:
- name: 创建 Issue
url: https://issue.zfile.vip/

View File

@@ -1,61 +1,83 @@
# ZFile
<div align="center">
<a href="https://zfile.vip" target="_blank" rel="noopener noreferrer">
<img style="margin: auto; width: 100px; display: block" src="/img/logo-zfile.png" alt="ZFile" />
</a>
<p>ZFile 是一个适用于个人或小团队的在线网盘程序,可以将多种存储类型统一管理,再也不用登录各种网站管理文件,现在你只需要在 ZFile 中畅快使用!</p>
<div>
<img alt="last commit" src="https://shields.io/github/last-commit/zhaojun1998/zfile.svg?style=flat-square"/>
<img alt="downloads" src="https://shields.io/github/downloads/zhaojun1998/zfile/total?style=flat-square"/>
<img alt="release version" src="https://shields.io/github/v/release/zhaojun1998/zfile?style=flat-square"/>
<img alt="commit activity" src="https://shields.io/github/commit-activity/y/zhaojun1998/zfile?style=flat-square"/>
<img alt="open issues" src="https://shields.io/github/issues/zhaojun1998/zfile?style=flat-square"/>
<img alt="closed issues" src="https://shields.io/github/issues-closed-raw/zhaojun1998/zfile?style=flat-square"/>
<img alt="forks" src="https://shields.io/github/forks/zhaojun1998/zfile?style=flat-square"/>
<img alt="stars" src="https://shields.io/github/stars/zhaojun1998/zfile?style=flat-square"/>
<img alt="watchers" src="https://shields.io/github/watchers/zhaojun1998/zfile?style=flat-square"/>
</div>
<span>
<a href="https://zfile.vip">官网</a>
<span> | </span>
<a href="https://docs.zfile.vip">文档</a>
<span> | </span>
<a href="https://demo.zfile.vip">预览地址</a>
</span>
</div>
[![ZFile License](https://img.shields.io/badge/license-MIT-blue.svg?longCache=true&style=flat-square)](https://github.com/zfile-dev/zfile/blob/main/LICENSE)
[![GitHub release](https://shields.io/github/v/release/zhaojun1998/zfile?style=flat-square)](https://github.com/zfile-dev/zfile/releases)
<img src="https://api.codacy.com/project/badge/Grade/70b793267f7941d58cbd93f50c9a8e0a"/>
[![Docker Pulls](https://img.shields.io/docker/pulls/zhaojun1998/zfile)](https://hub.docker.com/r/zhaojun1998/zfile)
[![宝塔服务器面板,一键全能部署及管理](https://img.shields.io/badge/BT_Deploy-Install-20a53a)](https://www.bt.cn/u/WYVNdM)
## 系统特色
## ZFile 是什么?
ZFile 是一个适用于个人的在线网盘(列目录)程序,可以将你各个存储类型的存储源,统一到一个网页中查看、预览、维护,再也不用去登录各种各样的网页登录后管理文件,现在你只需要在 ZFile 中使用。你只需要填写存储源相关信息,其他的令牌刷新,授权都是尽量自动化的,且有完善的文档帮助你使用
- 支持对接 S3、OneDrive、SharePoint、Google Drive、多吉云、又拍云、本地存储、FTP、SFTP 等存储源
- 支持在线浏览图片、播放音视频文本文件、Office、obj3d等文件类型
- Docker、Docker Compose 支持(amd64, arm64)。
- 支持对文件生成直链、短链(可设过期时间)。
- 响应式设计,支持手机、平板、电脑等多种设备访问
- 支持多用户功能,可分配给指定用户指定存储源或目录。
- 支持在线浏览图片、播放音视频文本文件、Office、Obj3d等文件类型。
- 支持对接 S3、OneDrive、SharePoint、Google Drive、多吉云、又拍云、本地存储、FTP、SFTP 等存储源
- 支持常用快捷键,`Ctrl + A` 全选,`Ctrl + 左键` 多选,`Shift + 左键` 范围选择,`Esc` 取消全选等。
- 支持限速下载(捐赠版)
- 支持限制指定用户可查看、上传的文件类型(捐赠版)
## 快速开始
请参考部署文档: [https://docs.zfile.vip](https://docs.zfile.vip)
一键脚本安装:
## 在线体验
```bash
curl -sSL https://docs.zfile.vip/install.sh -o install.sh && chmod +x install.sh && ./install.sh
```
更多安装方式请参考 [安装文档](https://docs.zfile.vip/install/)
[https://demo.zfile.vip](https://demo.zfile.vip)
## 功能预览
### 文件列表
![文件列表](https://cdn.jun6.net/uPic/2022/08/13/0urMn8.png)
![文件列表](/img/file-list.png)
### 画廊模式
![图片预览](https://cdn.jun6.net/uPic/2022/08/13/d2J9aE.png)
![图片预览](/img/gallery.png)
### 视频预览
![视频预览](https://cdn.jun6.net/uPic/2022/08/13/tBX00R.png)
![视频预览](/img/preview-video.png)
### 文本预览
![文本预览](https://cdn.jun6.net/uPic/2022/08/13/7dDy4G.png)
![文本预览](/img/preview-text.png)
### 音频预览
![音频预览](https://cdn.jun6.net/uPic/2022/08/13/N5bU1R.png)
![音频预览](/img/preview-audio.png)
### PDF 预览
![PDF 预览](https://cdn.jun6.net/uPic/2022/08/13/H327bV.png)
![PDF 预览](/img/preview-pdf.png)
### Office 预览
![Office 预览](https://cdn.jun6.net/uPic/2022/08/27/RxeiqI.png)
![Office 预览](/img/preview-office.png)
### 3d 文件预览
![3d 文件预览](https://cdn.jun6.net/uPic/2022/08/29/8iszyh.png)
![3d 文件预览](/img/preview-3d.png)
### 生成直链
![生成直链](https://cdn.jun6.net/uPic/2022/08/13/zCX3xT.jpg)
![生成直链](/img/generate-link.jpeg)
### 页面设置
![页面设置](https://cdn.jun6.net/uPic/2022/08/13/54nYv2.png)
![页面设置](/img/page-setting.png)
### 后台设置-登录
![后台设置-登录](https://cdn.jun6.net/uPic/2022/08/13/J8P2Zf.png)
![后台设置-登录](/img/login.png)
### 后台设置-存储源列表
![后台设置-存储源列表](https://cdn.jun6.net/uPic/2022/08/13/jymieO.png)
### 后台设置-存储源权限控制
![后台设置-存储源权限控制](https://cdn.jun6.net/uPic/2022/08/13/JgiwkH.jpg)
![后台设置-存储源列表](/img/storage-list.png)
### 后台设置-添加存储源(本地存储)
![后台设置-添加存储源(本地存储)](https://cdn.jun6.net/uPic/2022/08/13/add-storage.png)
### 后台设置-添加存储源(世纪互联)
![后台设置-添加存储源(世纪互联)](https://cdn.jun6.net/uPic/2022/08/13/add-storage2.png)
![后台设置-添加存储源(本地存储)](/img/storage-edit-local.png)
### 后台设置-用户管理
![后台设置-存储源权限控制](/img/user-edit.png)
### 后台设置-显示设置
![后台设置-显示设置](https://cdn.jun6.net/uPic/2022/08/13/view-setting.png)
![后台设置-显示设置](/img/view-setting.png)
## 支持作者
@@ -63,10 +85,6 @@ ZFile 是一个适用于个人的在线网盘(列目录)程序,可以将你各
<img src="https://cdn.jun6.net/2021/03/27/152704e91f13d.png" width="400" alt="赞助我">
## Status
![Alt](https://repobeats.axiom.co/api/embed/580333f83b91087e713f15497e6433c50e1da090.svg "Repobeats analytics image")
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=zfile-dev/zfile&type=Date)](https://star-history.com/#zfile-dev/zfile&Date)

BIN
img/file-list.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
img/gallery.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 KiB

BIN
img/generate-link.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

BIN
img/login.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
img/logo-zfile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/page-setting.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

BIN
img/preview-3d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

BIN
img/preview-audio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
img/preview-office.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
img/preview-pdf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

BIN
img/preview-text.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

BIN
img/preview-video.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 KiB

BIN
img/storage-edit-local.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 KiB

BIN
img/storage-list.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
img/user-edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

BIN
img/view-setting.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

View File

@@ -182,7 +182,7 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.5</version>
<version>5.4.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>

View File

@@ -2,11 +2,15 @@ package im.zhaojun.zfile.core.util;
import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.CacheObj;
import im.zhaojun.zfile.module.onlyoffice.model.OnlyOfficeFile;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.RandomStringUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
@@ -83,6 +87,45 @@ public class OnlyOfficeKeyCacheUtils {
return onlyOfficeFile;
}
/**
* 清理缓存中的文件信息与 Key 的映射关系.(文件发生了变化, 需要重新生成 OnlyOffice 预览链接时调用)
*
* @param onlyOfficeFile
* OnlyOffice 文件信息
*/
public static OnlyOfficeFile removeByFile(OnlyOfficeFile onlyOfficeFile) {
String key = ONLY_OFFICE_FILE_KEY_MAP.get(onlyOfficeFile);
if (key == null) {
return null;
}
ONLY_OFFICE_FILE_KEY_MAP.remove(onlyOfficeFile);
ONLY_OFFICE_KEY_FILE_MAP.remove(key);
return onlyOfficeFile;
}
/**
* 清理缓存中的某个文件夹下所有文件信息与 Key 的映射关系.(文件发生了变化, 需要重新生成 OnlyOffice 预览链接时调用)
*
* @param onlyOfficeFile
* OnlyOffice 文件信息
*/
public static List<OnlyOfficeFile> removeByFolder(OnlyOfficeFile onlyOfficeFile) {
List<OnlyOfficeFile> caches = new ArrayList<>();
Iterator<CacheObj<OnlyOfficeFile, String>> cacheObjIterator = ONLY_OFFICE_FILE_KEY_MAP.cacheObjIterator();
while (cacheObjIterator.hasNext()) {
CacheObj<OnlyOfficeFile, String> cacheObj = cacheObjIterator.next();
OnlyOfficeFile cacheOnlyOfficeFile = cacheObj.getKey();
if (cacheOnlyOfficeFile.getStorageKey().equals(onlyOfficeFile.getStorageKey())
&& StringUtils.startWith(cacheOnlyOfficeFile.getPathAndName(), onlyOfficeFile.getPathAndName())) {
ONLY_OFFICE_FILE_KEY_MAP.remove(cacheObj.getKey());
ONLY_OFFICE_KEY_FILE_MAP.remove(cacheObj.getValue());
caches.add(cacheOnlyOfficeFile);
}
}
return caches;
}
/**
* 获取文件锁, 防止并发操作文件缓存时出现问题.
*

View File

@@ -101,6 +101,9 @@ public class OnlyOfficeController {
throw new BizException("文件不存在");
}
String currentUserBasePath = fileService.getCurrentUserBasePath();
fileItemRequest.setPath(StringUtils.concat(currentUserBasePath, fileItemRequest.getPath()));
boolean hasUploadPermission = userStorageSourceService.hasCurrentUserStorageOperatorPermission(storageId, FileOperatorTypeEnum.UPLOAD);
return Pair.of(fileItem, hasUploadPermission);
} catch (Exception e) {
@@ -163,17 +166,17 @@ public class OnlyOfficeController {
log.debug("OnlyOffice 回调信息: {}, {}", onlyOfficeCallback.getStatus(), onlyOfficeCallback);
boolean useOnlyOfficeSecret = StrUtil.isNotBlank(systemConfigService.getSystemConfig().getOnlyOfficeSecret());
if (useOnlyOfficeSecret) {
if (StrUtil.isBlank(onlyOfficeCallback.getToken())) {
log.error("OnlyOffice 回调 Token 为空: {}", onlyOfficeCallback);
return CALLBACK_ERROR_MSG;
}
if (!JWTUtil.verify(onlyOfficeCallback.getToken(), StrUtil.bytes(systemConfigService.getSystemConfig().getOnlyOfficeSecret(), StandardCharsets.UTF_8))) {
log.error("OnlyOffice 回调 Token 验证失败: {}", onlyOfficeCallback);
return CALLBACK_ERROR_MSG;
return CALLBACK_ERROR_MSG;
}
}
// 文件发送了变化,清空缓存中该文件的 key 信息.
if (SUPPORTED_STATUS.contains(onlyOfficeCallback.getStatus())) {

View File

@@ -1,16 +1,21 @@
package im.zhaojun.zfile.module.storage.aspect;
import im.zhaojun.zfile.core.util.ZFileAuthUtil;
import im.zhaojun.zfile.module.user.model.entity.User;
import org.apache.commons.lang3.BooleanUtils;
import im.zhaojun.zfile.core.exception.biz.StorageSourceIllegalOperationBizException;
import im.zhaojun.zfile.core.util.CollectionUtils;
import im.zhaojun.zfile.core.util.OnlyOfficeKeyCacheUtils;
import im.zhaojun.zfile.core.util.StringUtils;
import im.zhaojun.zfile.core.util.ZFileAuthUtil;
import im.zhaojun.zfile.module.onlyoffice.model.OnlyOfficeFile;
import im.zhaojun.zfile.module.storage.annotation.StoragePermissionCheck;
import im.zhaojun.zfile.module.storage.model.enums.FileOperatorTypeEnum;
import im.zhaojun.zfile.module.storage.service.StorageSourceService;
import im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService;
import im.zhaojun.zfile.module.user.model.entity.User;
import im.zhaojun.zfile.module.user.model.entity.UserStorageSource;
import im.zhaojun.zfile.module.user.service.UserStorageSourceService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
@@ -18,8 +23,9 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import jakarta.annotation.Resource;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Objects;
import java.util.Set;
/**
@@ -85,7 +91,8 @@ public class FileOperatorCheckAspect {
@Around("execution(public * im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService.fileList(..)) || " +
"execution(public * im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService.getFileItem(..))")
public Object availableAround(ProceedingJoinPoint point) throws Throwable {
return check(point, FileOperatorTypeEnum.AVAILABLE);
checkPermission(point, FileOperatorTypeEnum.AVAILABLE);
return point.proceed();
}
/**
@@ -98,7 +105,8 @@ public class FileOperatorCheckAspect {
*/
@Around("execution(public * im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService.newFolder(..))")
public Object newFolderAround(ProceedingJoinPoint point) throws Throwable {
return check(point, FileOperatorTypeEnum.NEW_FOLDER);
checkPermission(point, FileOperatorTypeEnum.NEW_FOLDER);
return point.proceed();
}
/**
@@ -111,7 +119,19 @@ public class FileOperatorCheckAspect {
*/
@Around("execution(public * im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService.delete*(..))")
public Object deleteAround(ProceedingJoinPoint point) throws Throwable {
return check(point, FileOperatorTypeEnum.DELETE);
checkPermission(point, FileOperatorTypeEnum.DELETE);
Object result = point.proceed();
boolean isFolder = point.getSignature().getName().equals("deleteFolder");
AbstractBaseFileService<?> targetService = (AbstractBaseFileService<?>) point.getTarget();
String path = (String) point.getArgs()[0];
String name = (String) point.getArgs()[1];
String currentUserBasePath = targetService.getCurrentUserBasePath();
String fullPath = StringUtils.concat(currentUserBasePath, path, name);
clearOnlyOfficeCache(fullPath, targetService.storageId, isFolder);
return result;
}
/**
@@ -125,7 +145,26 @@ public class FileOperatorCheckAspect {
@Around("execution(public * im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService.getUploadUrl(..)) || " +
"execution(public * im.zhaojun.zfile.module.storage.service.base.AbstractProxyTransferService.uploadFile(..))")
public Object uploadAround(ProceedingJoinPoint point) throws Throwable {
return check(point, FileOperatorTypeEnum.UPLOAD);
checkPermission(point, FileOperatorTypeEnum.UPLOAD);
Object[] args = point.getArgs();
AbstractBaseFileService<?> targetService = (AbstractBaseFileService<?>) point.getTarget();
String currentUserBasePath = targetService.getCurrentUserBasePath();
String fullPath;
String methodName = point.getSignature().getName();
if (Objects.equals(methodName, "getUploadUrl")) {
fullPath = StringUtils.concat(currentUserBasePath, (String) args[0], (String) args[1]);
} else if (Objects.equals(methodName, "uploadFile")) {
fullPath = StringUtils.concat(currentUserBasePath, (String) args[0]);
} else {
throw new IllegalArgumentException("上传校验异常.");
}
Object result = point.proceed();
clearOnlyOfficeCache(fullPath, targetService.storageId, false);
return result;
}
/**
@@ -138,7 +177,22 @@ public class FileOperatorCheckAspect {
*/
@Around("execution(public * im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService.rename*(..))")
public Object renameAround(ProceedingJoinPoint point) throws Throwable {
return check(point, FileOperatorTypeEnum.RENAME);
checkPermission(point, FileOperatorTypeEnum.RENAME);
AbstractBaseFileService<?> targetService = (AbstractBaseFileService<?>) point.getTarget();
String currentUserBasePath = targetService.getCurrentUserBasePath();
Object[] args = point.getArgs();
String path = (String) args[0];
String name = (String) args[1];
String newName = (String) args[2];
String sourceFullPath = StringUtils.concat(currentUserBasePath, path, name);
String targetFullPath = StringUtils.concat(currentUserBasePath, path, newName);
Object result = point.proceed();
clearOnlyOfficeCache(sourceFullPath, targetService.storageId, Objects.equals(point.getSignature().getName(), "renameFolder"));
return result;
}
/**
@@ -151,7 +205,17 @@ public class FileOperatorCheckAspect {
*/
@Around("execution(public * im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService.move*(..))")
public Object moveAround(ProceedingJoinPoint point) throws Throwable {
return check(point, FileOperatorTypeEnum.MOVE);
checkPermission(point, FileOperatorTypeEnum.MOVE);
Object result = point.proceed();
AbstractBaseFileService<?> targetService = (AbstractBaseFileService<?>) point.getTarget();
String path = (String) point.getArgs()[0];
String name = (String) point.getArgs()[1];
String currentUserBasePath = targetService.getCurrentUserBasePath();
String fullPath = StringUtils.concat(currentUserBasePath, path, name);
clearOnlyOfficeCache(fullPath, targetService.storageId, Objects.equals(point.getSignature().getName(), "moveFolder"));
return result;
}
/**
@@ -164,7 +228,8 @@ public class FileOperatorCheckAspect {
*/
@Around("execution(public * im.zhaojun.zfile.module.storage.service.base.AbstractBaseFileService.copy*(..))")
public Object copyAround(ProceedingJoinPoint point) throws Throwable {
return check(point, FileOperatorTypeEnum.COPY);
checkPermission(point, FileOperatorTypeEnum.COPY);
return point.proceed();
}
/**
@@ -175,10 +240,8 @@ public class FileOperatorCheckAspect {
*
* @param fileOperatorType
* 文件操作类型
*
* @return 方法运行结果
*/
private Object check(ProceedingJoinPoint point, FileOperatorTypeEnum fileOperatorType) throws Throwable {
private void checkPermission(ProceedingJoinPoint point, FileOperatorTypeEnum fileOperatorType) {
// 获取对应的存储源 service
AbstractBaseFileService<?> targetService = (AbstractBaseFileService<?>) point.getTarget();
Integer storageId = targetService.storageId;
@@ -188,8 +251,6 @@ public class FileOperatorCheckAspect {
if (BooleanUtils.isFalse(allowAccess)) {
throw new StorageSourceIllegalOperationBizException(storageId, fileOperatorType);
}
return point.proceed();
}
@@ -215,4 +276,32 @@ public class FileOperatorCheckAspect {
return permissions.contains(fileOperatorType.getValue());
}
/**
* 清除 OnlyOffice 缓存
*
* @param fullPath
* 文件全路径(包含用户路径)
*
* @param storageId
* 存储源 ID
*/
private void clearOnlyOfficeCache(String fullPath, Integer storageId, boolean isFolder) {
try {
String storageKey = storageSourceService.findStorageKeyById(storageId);
if (isFolder) {
List<OnlyOfficeFile> caches = OnlyOfficeKeyCacheUtils.removeByFolder(new OnlyOfficeFile(storageKey, fullPath));
if (CollectionUtils.isNotEmpty(caches)) {
log.debug("删除/重命名文件夹时, 清除 OnlyOffice 缓存 {} 个", caches);
}
} else {
OnlyOfficeFile onlyOfficeFile = OnlyOfficeKeyCacheUtils.removeByFile(new OnlyOfficeFile(storageKey, fullPath));
if (onlyOfficeFile != null) {
log.debug("删除/重命名文件时, 清除 OnlyOffice 缓存: {}", onlyOfficeFile);
}
}
} catch (Exception e) {
log.error("清除 OnlyOffice 缓存失败", e);
}
}
}