mirror of
https://code.chipmunk.land/ChomeNS/chipmunkmod.git
synced 2025-11-13 18:46:15 +00:00
refactor: remove out-of-bounds location in LocationArgumentType since it's pointless
This commit is contained in:
parent
7f9d942754
commit
3a5e4490ee
1 changed files with 1 additions and 5 deletions
|
|
@ -18,8 +18,6 @@ import java.util.Collection;
|
|||
public class LocationArgumentType implements ArgumentType<Object> {
|
||||
private static final Collection<String> EXAMPLES = Arrays.asList("songs/amogus.mid", "images/cat.jpg", "videos/badapple.mp4");
|
||||
|
||||
private static final SimpleCommandExceptionType OOB_FILEPATH = new SimpleCommandExceptionType(Text.translatable("The specified file path is outside of the allowed directory"));
|
||||
|
||||
private final boolean allowsUrls;
|
||||
private final boolean allowsPaths;
|
||||
private final Path root;
|
||||
|
|
@ -59,9 +57,7 @@ public class LocationArgumentType implements ArgumentType<Object> {
|
|||
|
||||
public Path parsePath (StringReader reader) throws CommandSyntaxException {
|
||||
final String pathString = reader.readString();
|
||||
final Path path = Path.of(root.toString(), pathString).toAbsolutePath().normalize();
|
||||
if (!path.startsWith(root)) throw OOB_FILEPATH.create();
|
||||
return path;
|
||||
return Path.of(root.toString(), pathString).toAbsolutePath().normalize();
|
||||
}
|
||||
|
||||
private static Object getLocation (CommandContext<?> context, String name) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue