Skip to content
Snippets Groups Projects
Commit b417647b authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Check batch-uploaded filenames for illegal characters/sequences/names

The BadFilename text.dat is now a format string (prints the bad filename).
Use the nice progress() display status while searching for duplicate filenames.
parent 23d36a63
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -512,6 +512,10 @@ void sbbs_t::batch_upload()
SAFEPRINTF2(src, "%s%s", cfg.temp_dir,dirent->d_name);
if(isdir(src))
continue;
if(!checkfname(dirent->d_name)) {
bprintf(text[BadFilename], dirent->d_name);
continue;
}
SAFEPRINTF2(dest, "%s%s", cfg.dir[cfg.upload_dir]->path, dirent->d_name);
if(fexistcase(dest)) {
bprintf(text[FileAlreadyOnline], dirent->d_name);
......@@ -520,9 +524,9 @@ void sbbs_t::batch_upload()
if(mv(src, dest, /* copy: */false))
continue;
bputs(text[SearchingForDupes]);
uint x,y;
for(x=0;x<usrlibs;x++) {
progress(text[SearchingForDupes], x, usrlibs, 1);
for(y=0;y<usrdirs[x];y++)
if(cfg.dir[usrdir[x][y]]->misc&DIR_DUPES
&& findfile(&cfg,usrdir[x][y], dirent->d_name, NULL))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment