🐛 修复 ftp 模式, 依旧获取尝试获取 readme 内容的 BUG.

This commit is contained in:
zhaojun1998
2020-08-15 17:48:51 +08:00
parent b31982b788
commit ee6c04fa11

View File

@@ -142,12 +142,16 @@ public class FileController {
SystemFrontConfigDTO systemConfig = systemConfigService.getSystemFrontConfig(driveId);
AbstractBaseFileService fileService = driveContext.get(driveId);
DriveConfig driveConfig = driveConfigService.findById(driveId);
String fullPath = StringUtils.removeDuplicateSeparator(path + ZFileConstant.PATH_SEPARATOR + ZFileConstant.README_FILE_NAME);
FileItemDTO fileItem = null;
try {
fileItem = fileService.getFileItem(fullPath);
String readme = HttpUtil.getTextContent(fileItem.getUrl());
systemConfig.setReadme(readme);
if (!Objects.equals(driveConfig.getType(), StorageTypeEnum.FTP)) {
String readme = HttpUtil.getTextContent(fileItem.getUrl());
systemConfig.setReadme(readme);
}
} catch (Exception e) {
if (e instanceof NotExistFileException) {
log.debug("不存在 README 文件, 已跳过, fullPath: {}, fileItem: {}", fullPath, JSON.toJSONString(fileItem));