fix:任务执行文件搜索
This commit is contained in:
@@ -2401,14 +2401,29 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
String objectKey = dirMetadataInfo.getObjectKey();
|
||||
String prefix = dirTypeEnum.getDirName();
|
||||
|
||||
// 检查是否以指定前缀开头
|
||||
if (!objectKey.startsWith(prefix)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// knowledge/知识库A/子目录/ 移除前缀knowledge/和最后的/后 ->知识库A/子目录
|
||||
return objectKey.substring(prefix.length()+1, objectKey.length() - 1);
|
||||
// 如果 objectKey 等于 prefix + "/",说明是根目录,直接返回空字符串
|
||||
if (objectKey.equals(prefix + "/")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 截取相对路径部分:移除前缀和末尾的 "/"
|
||||
int beginIndex = prefix.length() + 1; // 起始位置为 prefix 后的第一个字符
|
||||
int endIndex = objectKey.length() - 1; // 结束位置为倒数第二个字符(去掉末尾的 "/")
|
||||
|
||||
// 确保 beginIndex 不超过 endIndex,避免越界
|
||||
if (beginIndex >= endIndex) {
|
||||
return ""; // 返回空字符串表示没有子路径
|
||||
}
|
||||
|
||||
return objectKey.substring(beginIndex, endIndex);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SdmResponse downloadRecord(AddDownloadRecordReq req) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user