mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix missing validation on invalid characters in file name (#18287)
When saving a new file with a name containing '/' or '\' on Windows, the incorrect file name would be determined since these characters represent a new folder. This would trigger a failure on save. The user's input should be validated in all cases. Before, it was only executed for folder names. This change also applies the validation on file names.
This commit is contained in:
parent
10be64abad
commit
0c78a27d9f
|
@ -1,6 +1,7 @@
|
|||
0.4.3 (in development)
|
||||
------------------------------------------------------------------------
|
||||
- Fix: [#14312] Research ride type message incorrect.
|
||||
- Fix: [#17763] Missing validation on invalid characters in file name.
|
||||
- Fix: [#17853] Invention name tears while being dragged.
|
||||
- Fix: [#18064] Unable to dismiss notification messages.
|
||||
- Fix: [#18070] Underground entrance/exit shows through terrain walls (original bug).
|
||||
|
|
|
@ -575,16 +575,16 @@ static void WindowLoadsaveTextinput(rct_window* w, WidgetIndex widgetIndex, char
|
|||
if (text == nullptr || text[0] == 0)
|
||||
return;
|
||||
|
||||
if (!Platform::IsFilenameValid(text))
|
||||
{
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_NEW_FOLDER:
|
||||
{
|
||||
if (!Platform::IsFilenameValid(text))
|
||||
{
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
const u8string path = Path::Combine(_directory, text);
|
||||
if (!Platform::EnsureDirectoryExists(path))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue