修改删除提示错误

修改删除提示错误

Signed-off-by: 高雄 <admin@cxcp.com>
This commit is contained in:
高雄 2023-04-11 01:39:31 +00:00 committed by Gitee
parent 55ca17203f
commit 138e58a1e1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -36,7 +36,6 @@ public class FileController {
private final String demoDir = "demo"; private final String demoDir = "demo";
private final String demoPath = demoDir + File.separator; private final String demoPath = demoDir + File.separator;
public static final String BASE64_DECODE_ERROR_MSG = "Base64解码失败请检查你的 %s 是否采用 Base64 + urlEncode 双重编码了!"; public static final String BASE64_DECODE_ERROR_MSG = "Base64解码失败请检查你的 %s 是否采用 Base64 + urlEncode 双重编码了!";
private static final String[] not_allowed = { "dll", "exe", "msi" }; // 不允许上传的文件扩展名
@PostMapping("/fileUpload") @PostMapping("/fileUpload")
public ReturnResponse<Object> fileUpload(@RequestParam("file") MultipartFile file) { public ReturnResponse<Object> fileUpload(@RequestParam("file") MultipartFile file) {
@ -65,11 +64,11 @@ public class FileController {
if (checkResult.isFailure()) { if (checkResult.isFailure()) {
return checkResult; return checkResult;
} }
fileName = checkResult.getContent().toString();
if(!ConfigConstants.getpassword().equalsIgnoreCase(password)){ if(!ConfigConstants.getpassword().equalsIgnoreCase(password)){
logger.error("删除文件【{}】失败,密码错误!",fileName); logger.error("删除文件【{}】失败,密码错误!",fileName);
return ReturnResponse.failure("删除文件失败,密码错误!"); return ReturnResponse.failure("删除文件失败,密码错误!");
} }
fileName = checkResult.getContent().toString();
File file = new File(fileDir + demoPath + fileName); File file = new File(fileDir + demoPath + fileName);
logger.info("删除文件:{}", file.getAbsolutePath()); logger.info("删除文件:{}", file.getAbsolutePath());
if (file.exists() && !file.delete()) { if (file.exists() && !file.delete()) {