fix
This commit is contained in:
parent
618652784e
commit
48ad6da53a
@ -6,6 +6,7 @@ import com.knowledge.base.application.service.DocAppService;
|
||||
import com.knowledge.base.application.service.UserAppService;
|
||||
import com.knowledge.base.domain.doc.service.iface.DocumentImporter;
|
||||
import com.knowledge.base.infrastructure.cache.FileCacheService;
|
||||
import com.knowledge.base.infrastructure.config.ConstantConfig;
|
||||
import com.knowledge.base.infrastructure.config.ObjectStorageProperties;
|
||||
import com.knowledge.base.infrastructure.north.dto.doc.OSRecordDTO;
|
||||
import com.knowledge.base.infrastructure.north.dto.user.UserDTO;
|
||||
@ -136,11 +137,13 @@ public class FileWriteController {
|
||||
|
||||
@PostMapping("/upload-files")
|
||||
public ResponseEntity<?> uploadFolderToOS(
|
||||
@CookieValue(value = ConstantConfig.COOKIE_KEY, required = false) String cookieToken,
|
||||
@RequestHeader("Authorization") String token,
|
||||
@RequestParam("files") MultipartFile[] files,
|
||||
@RequestParam("bucket") String bucket
|
||||
) {
|
||||
try {
|
||||
token = StrUtil.isBlank(token) ? cookieToken : token;
|
||||
objectStorageGateway.ensureBucketExists(bucket);
|
||||
Map<String, String> filePathMap = new LinkedHashMap<>();
|
||||
|
||||
@ -170,9 +173,10 @@ public class FileWriteController {
|
||||
|
||||
// 异步写入 OSS 上传记录
|
||||
String finalSafeName = safeName;
|
||||
String finalToken = token;
|
||||
ThreadPoolUtil.execute(() -> {
|
||||
try {
|
||||
Optional<UserTokenDTO> userTokenDTO = userAppService.findToken(token);
|
||||
Optional<UserTokenDTO> userTokenDTO = userAppService.findToken(finalToken);
|
||||
if (userTokenDTO.isEmpty()) {
|
||||
logger.warn("异步写入失败:无效 token");
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user