mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 23:30:41 +09:00
Bad Windows names also apply with any extension
A file name con.zip is also treated in the same way as the special CON redirection and may not be used as a normal filesystem path in Windows. This includes any extension, even with multiple dots. Fix checkFilename and cleaneFilename not handling these cases.
This commit is contained in:
1 parent
14934a0d3a
commit
9a1c7b2ecd
2 files changed
+35
-27
No files matched your search
+10
-2
@@ -115,13 +115,17 @@ describe("lib/file_ops", function() {
|
||||
|
||||
it("should throw on CON, PRN, AUX, NUL, COM1, LPT1", function() {
|
||||
for (let bad of ["CON", "PRN", "AUX", "NUL", "COM1", "LPT1"]) {
|
||||
check(bad, "cannot be named any of . .. CON PRN AUX NUL COM1-9 and LPT1-9");
|
||||
check(bad, "cannot be named any of CON PRN AUX NUL COM1-9 and LPT1-9");
|
||||
check(`${bad}.zip`, "cannot be named any of CON PRN AUX NUL COM1-9 and LPT1-9");
|
||||
check(`${bad}.anything.txt`, "cannot be named any of CON PRN AUX NUL COM1-9 and LPT1-9");
|
||||
check(`${bad}....a`, "cannot be named any of CON PRN AUX NUL COM1-9 and LPT1-9");
|
||||
check(`${bad}.`, "cannot be named any of CON PRN AUX NUL COM1-9 and LPT1-9");
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw on . and ..", function() {
|
||||
for (let bad of [".", ".."]) {
|
||||
check(bad, "cannot be named any of . .. CON PRN AUX NUL COM1-9 and LPT1-9");
|
||||
check(bad, `cannot be named ${bad}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -166,6 +170,10 @@ describe("lib/file_ops", function() {
|
||||
it("should clean CON, PRN, AUX, NUL, COM1, LPT1", function() {
|
||||
for (let bad of ["CON", "PRN", "AUX", "NUL", "COM1", "LPT1"]) {
|
||||
clean(bad, `${bad}_`);
|
||||
clean(`${bad}.zip`, `${bad}_.zip`);
|
||||
clean(`${bad}.anything.txt`, `${bad}_.anything.txt`);
|
||||
clean(`${bad}....a`, `${bad}_....a`);
|
||||
clean(`${bad}.`, `${bad}__`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user