use of com.github.zhanhb.download.spring.ToDownload in project judge by zjnu-acm.
the class CKFinderController method ckfinder.
@Nullable
@ToDownload
@GetMapping("/support/ckfinder")
public Path ckfinder(@RequestParam("path") String path) {
log.info(path);
try {
int indexOf = path.indexOf('?');
Path parent = judgeConfiguration.getUploadDirectory();
Path imagePath = parent.getFileSystem().getPath(parent.toString(), indexOf > 0 ? path.substring(0, indexOf) : path).normalize();
if (!imagePath.startsWith(parent)) {
log.debug("absolute path parent='{}' path='{}'", parent, imagePath);
return null;
}
return imagePath;
} catch (IllegalArgumentException ex) {
return null;
}
}
Aggregations