| 487 | } |
| 488 | |
| 489 | const char *fixzipname(char *name) // check, if valid path + filename, based on mods/, return NULL if invalid |
| 490 | { |
| 491 | string tmp; |
| 492 | unixpath(name); // changes "name"! |
| 493 | filtertext(tmp, name, FTXT__MEDIAFILEPATH); |
| 494 | const char *bp = behindpath(tmp), *pd = parentdir(tmp); |
| 495 | static defformatstring(pname)("%s%s%s%s", pd, bp != tmp ? "/" : "", !strncmp("###", behindpath(name), 3) ? "###" : "", bp); |
| 496 | if(strlen(name) > 40 || strchr(name, '.') || strcmp(pname, name) || *name == '/') return NULL; // illegal filename |
| 497 | formatstring(pname)("mods/%s.zip", name); |
| 498 | return path(pname); |
| 499 | } |
| 500 | |
| 501 | bool validzipmodname(char *name) // check for valid _downloadable_ zip mod name (no '#' allowed), also changes backslashes to slashes |
| 502 | { |
no test coverage detected