当对应文件找不到的时候,尝试通过gid查找文件
This commit is contained in:
parent
8c0ca78dc6
commit
fb5ff43364
@ -69,9 +69,29 @@ public class MultiThreadedHTTPServer {
|
||||
file = new File("/root/abc");
|
||||
}else {
|
||||
String name = path.substring(0, path.lastIndexOf('.'));
|
||||
System.out.println(name);
|
||||
filePath += (name + "/" + name + ".zip");
|
||||
file = new File(filePath);
|
||||
name = filePath + name + "/" + name + ".zip";
|
||||
file = new File(name);
|
||||
|
||||
//该文件不存在
|
||||
if(!file.isFile()){
|
||||
String gid = paramMap.get("gid");
|
||||
|
||||
//文件不存在的情况下gid也不存在,直接404
|
||||
if(gid == null)
|
||||
file = new File("/root/abc");
|
||||
|
||||
//gid存在的情况下尝试查找对应的文件
|
||||
else {
|
||||
File[] galleryDirectories = (new File(filePath)).listFiles();
|
||||
|
||||
assert galleryDirectories != null;
|
||||
for (File galleryDirectory : galleryDirectories)
|
||||
if (galleryDirectory.getName().contains(gid)) {
|
||||
file = new File(galleryDirectory.getAbsolutePath(), galleryDirectory.getName() + ".zip");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user