Quote schematic file names in //schem list #3445
Quote schematic file names in //schem list #3445Madelyyn wants to merge 3 commits intoIntellectualSites:mainfrom
Conversation
worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java
Outdated
Show resolved
Hide resolved
worldedit-core/src/main/java/com/fastasyncworldedit/core/util/StringMan.java
Outdated
Show resolved
Hide resolved
SirYwell
left a comment
There was a problem hiding this comment.
(FA)WE currently doesn't allow saving schematics with spaces in their name, even when quoting it. Should that be changed too?
| if (value.isEmpty()) { | ||
| return "\"\""; | ||
| } |
There was a problem hiding this comment.
Does it make sense to handle an empty string like that?
| return "\"\""; | ||
| } | ||
|
|
||
| boolean quote = value.indexOf(' ') >= 0 || value.indexOf('\t') >= 0; |
There was a problem hiding this comment.
What's the idea behind including \t here?
| return value; | ||
| } | ||
|
|
||
| String escaped = value.replace("\\", "\\\\").replace("\"", "\\\""); |
There was a problem hiding this comment.
What's the intention behind this? It doesn't seem like Piston can deal with \" escaping, so this won't work if a file name contains a ".
| return UUID_PATTERN.matcher(str).find(); | ||
| } | ||
|
|
||
| public static String escape(String value) { |
There was a problem hiding this comment.
This method should have documentation describing its behavior.
There was a problem hiding this comment.
I’m not going to make any more changes to this, it’s a tiny merge to fix an annoyance I had- didn’t really intend on coming back in three weeks😭. I can move this it an issue instead if that’s better. Maintainer edits are also on.
If you want |
Description
Adds quotes to schematic file names that would be invalid w/o in the auto complete of //schem list
Submitter Checklist
@since TODO.