feat(制品库功能完善): 识别文件名称和文件路径时考虑数组溢出情况
This commit is contained in:
parent
22cebde067
commit
9465c09d11
|
|
@ -115,15 +115,21 @@ public class NexusAssetResultDataVo {
|
|||
|
||||
public String parseFileName() {
|
||||
String[] pathSplit = this.name.split("/");
|
||||
return pathSplit[pathSplit.length - 1];
|
||||
if (pathSplit.length > 0) {
|
||||
return pathSplit[pathSplit.length - 1];
|
||||
}
|
||||
return this.name;
|
||||
|
||||
}
|
||||
|
||||
public String parseDirectory() {
|
||||
// 找到最后一个"/"的位置
|
||||
int lastSlashIndex = name.lastIndexOf('/');
|
||||
|
||||
// 截取到"/"之前的所有字符作为文件夹路径
|
||||
return name.substring(0, lastSlashIndex);
|
||||
int lastSlashIndex = this.name.lastIndexOf('/');
|
||||
if (lastSlashIndex > 0) {
|
||||
// 截取到"/"之前的所有字符作为文件夹路径
|
||||
return this.name.substring(0, lastSlashIndex);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String parseNexusVersion() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue