Never allow uploading *.pbl files to the add-ons server,

...matching against this pattern case-insensitively.

Someone please remind me to look into fixing the Python client too..

(Forward-ported from 1.8 branch, 2010-07-13T07:50:49Z!shadowm@wesnoth.org.)
This commit is contained in:
Ignacio R. Morelle 2010-07-13 07:58:54 +00:00
parent 8cb06d71d1
commit 6b94bd1356
2 changed files with 8 additions and 1 deletions

View file

@ -194,6 +194,8 @@ Version 1.9.0-svn:
* Fixed a bug in scoring of AI recall list. Patch by billynux.
* Strip whitespace characters from .ign patterns (bug #15902)
* Fixed wesnoth_addon_manager's support for .ign files (bug #15846)
* Never allow uploading *.pbl files (case-insensitive) to the add-ons
server from the regular game client.
* When warning the player about installing add-ons with missing dependencies,
make 'OK' and 'Cancel' work as expected (bug #15960)
* Fixed tab completion not working in the new lobby (bug #14730)

View file

@ -236,6 +236,11 @@ static void archive_file(const std::string& path, const std::string& fname, conf
cfg["contents"] = encode_binary(strip_cr(read_file(path + '/' + fname),is_cfg));
}
inline bool looks_like_pbl(const std::string& file)
{
return utils::wildcard_string_match(utils::lowercase(file), "*.pbl");
}
static void archive_dir(const std::string& path, const std::string& dirname, config& cfg, std::pair<std::vector<std::string>, std::vector<std::string> >& ignore_patterns)
{
cfg["name"] = dirname;
@ -244,7 +249,7 @@ static void archive_dir(const std::string& path, const std::string& dirname, con
std::vector<std::string> files, dirs;
get_files_in_dir(dir,&files,&dirs);
for(std::vector<std::string>::const_iterator i = files.begin(); i != files.end(); ++i) {
bool valid = true;
bool valid = !looks_like_pbl(*i);
for(std::vector<std::string>::const_iterator p = ignore_patterns.first.begin(); p != ignore_patterns.first.end(); ++p) {
if (utils::wildcard_string_match(*i, *p)) {
valid = false;