mirror of
https://gitee.com/zhijiantianya/ruoyi-vue-pro.git
synced 2026-06-05 18:25:41 +08:00
Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro
This commit is contained in:
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.infra.framework.file.core.client.AbstractFileClie
|
||||
import cn.iocoder.yudao.module.infra.framework.file.core.utils.FilePathUtils;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_PATH_INVALID;
|
||||
@ -55,7 +56,7 @@ public class LocalFileClient extends AbstractFileClient<LocalFileClientConfig> {
|
||||
|
||||
private String getFilePath(String path) {
|
||||
FilePathUtils.validatePath(path);
|
||||
Path basePath = Path.of(config.getBasePath()).toAbsolutePath().normalize();
|
||||
Path basePath = Paths.get(config.getBasePath()).toAbsolutePath().normalize();
|
||||
Path filePath = basePath.resolve(path).normalize();
|
||||
if (!filePath.startsWith(basePath)) {
|
||||
throw exception(FILE_PATH_INVALID);
|
||||
|
||||
@ -4,7 +4,7 @@ import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_PATH_INVALID;
|
||||
@ -88,7 +88,7 @@ public class FilePathUtils {
|
||||
}
|
||||
try {
|
||||
// 使用 JDK Path 再兜底判断一次绝对路径
|
||||
if (Path.of(path).isAbsolute()) {
|
||||
if (Paths.get(path).isAbsolute()) {
|
||||
return false;
|
||||
}
|
||||
} catch (InvalidPathException ex) {
|
||||
|
||||
@ -121,11 +121,20 @@ public class IotAlertTriggerSceneRuleAction implements IotSceneRuleAction {
|
||||
}
|
||||
|
||||
private String resolveTemplateCode(IotAlertConfigDO config, IotAlertReceiveTypeEnum typeEnum) {
|
||||
String templateCode = switch (typeEnum) {
|
||||
case SMS -> config.getSmsTemplateCode();
|
||||
case MAIL -> config.getMailTemplateCode();
|
||||
case NOTIFY -> config.getNotifyTemplateCode();
|
||||
};
|
||||
String templateCode = null;
|
||||
switch (typeEnum) {
|
||||
case SMS:
|
||||
templateCode = config.getSmsTemplateCode();
|
||||
break;
|
||||
case MAIL:
|
||||
templateCode = config.getMailTemplateCode();
|
||||
break;
|
||||
case NOTIFY:
|
||||
templateCode = config.getNotifyTemplateCode();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return StrUtil.blankToDefault(templateCode, typeEnum.getTemplateCode());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user