reject whitespace and trailing dot
This commit is contained in:
parent
2fbf0c3495
commit
bf94e9f788
1 changed files with 6 additions and 0 deletions
|
@ -1552,6 +1552,12 @@ bool validate_file_name(const std::string & filename) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reject any leading or trailing ' ', or any trailing '.', these are stripped on Windows and will cause a different filename
|
||||||
|
// Unicode and other whitespace is not affected, only 0x20 space
|
||||||
|
if (filename.front() == ' ' || filename.back() == ' ' || filename.back() == '.') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Reject any ".." (currently stricter than necessary, it should be fine to just check for == ".." instead)
|
// Reject any ".." (currently stricter than necessary, it should be fine to just check for == ".." instead)
|
||||||
if (filename.find("..") != std::string::npos) {
|
if (filename.find("..") != std::string::npos) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue