use of com.infiniteautomation.mango.util.exception.TranslatableIllegalArgumentException in project ma-core-public by infiniteautomation.
the class FileStoreService method getPathWithinFileStore.
private FileStorePath getPathWithinFileStore(FileStore fileStore, String path) {
Path root = getFileStoreRoot(fileStore);
Path filePath = root.resolve(path).toAbsolutePath().normalize();
if (!filePath.startsWith(root)) {
throw new TranslatableIllegalArgumentException(new TranslatableMessage("filestore.invalidPath"));
}
return new FileStorePath(fileStore, filePath);
}
use of com.infiniteautomation.mango.util.exception.TranslatableIllegalArgumentException in project ma-core-public by infiniteautomation.
the class FileStoreService method resolveFileStore.
private FileStorePath resolveFileStore(Path path) {
Path absolutePath = path.toAbsolutePath().normalize();
if (!absolutePath.startsWith(fileStoreRoot)) {
throw new TranslatableIllegalArgumentException(new TranslatableMessage("filestore.invalidPath"));
}
Path relative = fileStoreRoot.relativize(absolutePath);
if (relative.getNameCount() == 0) {
throw new TranslatableIllegalArgumentException(new TranslatableMessage("filestore.invalidPath"));
}
String fileStoreName = relative.getName(0).toString();
FileStore fileStore = getWithoutPermissionCheck(fileStoreName);
return new FileStorePath(fileStore, absolutePath);
}
Aggregations