fix(upload): 修复本地文件上传路径生成问题

- 修复了在MAC系统下上传路径中用户名前缺少斜杠的问题
- 确保上传路径格式的一致性
This commit is contained in:
2025-12-31 13:47:09 +08:00
parent 4a4b3f1690
commit 5248d75a6e
2 changed files with 43 additions and 1 deletions
@@ -53,7 +53,7 @@ public class KitFileLocalUploadHelper {
if (StrUtil.isBlank(currentUserName)) { if (StrUtil.isBlank(currentUserName)) {
return PATH_MAC.replace("${appName}", appName).replace("${username}", ""); return PATH_MAC.replace("${appName}", appName).replace("${username}", "");
} }
return PATH_MAC.replace("${appName}", appName).replace("${username}", currentUserName); return PATH_MAC.replace("${appName}", appName).replace("${username}", "/" + currentUserName);
} }
return PATH_LINUX.replace("${appName}", appName); return PATH_LINUX.replace("${appName}", appName);
} }
@@ -0,0 +1,42 @@
/*
* Copyright 2021-2025 Odboy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.odboy.system.openapi;
import cn.odboy.annotation.AnonymousPostMapping;
import cn.odboy.system.service.SystemAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/auth")
@Api(tags = "系统:验证码管理")
public class SystemCaptchaOpenController {
@Autowired
private SystemAuthService systemAuthService;
@ApiOperation("获取验证码")
@AnonymousPostMapping(value = "/captcha/getImage")
public ResponseEntity<Map<String, Object>> getCode() {
Map<String, Object> imgResult = systemAuthService.getCaptchaInfo();
return ResponseEntity.ok(imgResult);
}
}