mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-05 20:21:00 +00:00
Added temporary support for paths 'terrain/../' and 'dialogs/../'.
This commit is contained in:
parent
b9acfee589
commit
1341ebe448
@ -994,6 +994,15 @@ std::string get_binary_file_location(const std::string& type, const std::string&
|
||||
return std::string();
|
||||
}
|
||||
|
||||
// Some parts of Wesnoth enjoy putting ".." inside filenames. This is
|
||||
// bad and should be fixed. But in the meantime, deal with them in a dumb way.
|
||||
std::string::size_type pos = filename.rfind("../");
|
||||
if (pos != std::string::npos) {
|
||||
std::string nf = filename.substr(pos + 3);
|
||||
WRN_FS << "Illegal path '" << filename << "' replaced by '" << nf << "'\n";
|
||||
return get_binary_file_location(type, nf);
|
||||
}
|
||||
|
||||
if (filename.find("..") != std::string::npos) {
|
||||
ERR_FS << "Illegal path '" << filename << "' (\"..\" not allowed).\n";
|
||||
return std::string();
|
||||
|
Loading…
x
Reference in New Issue
Block a user