Commit 3027701e authored by rswindell's avatar rswindell
Browse files

For Electrosys:

- Move files from temp directory to uploads directory *before* determining what the short filename is going to be (since the underlying file system can change the short filename during that process). This should resovle the issue of blind-uploading multiple files with long filenames that begin with the same prefix of 6-8 characters.
- Batch upload queue processing wasn't touched as part of this change. That logic probably also could use a similar fix.
parent be61b6a4
......@@ -639,17 +639,23 @@ void sbbs_t::batch_upload()
return;
dir=opendir(cfg.temp_dir);
while(dir!=NULL && (dirent=readdir(dir))!=NULL) {
SAFEPRINTF2(str1,"%s%s",cfg.temp_dir,dirent->d_name);
if(isdir(str1))
SAFEPRINTF2(tmp,"%s%s",cfg.temp_dir,dirent->d_name);
if(isdir(tmp))
continue;
SAFEPRINTF2(path,"%s%s",cfg.dir[f.dir]->path,dirent->d_name);
if(fexistcase(path)) {
bprintf(text[FileAlreadyOnline], dirent->d_name);
continue;
}
if(mv(tmp, path, /* copy: */false))
continue;
memset(&f,0,sizeof(file_t));
f.dir=cfg.upload_dir;
SAFECOPY(path,str1);
#ifdef _WIN32
GetShortPathName(str1, path, sizeof(path));
GetShortPathName(path, tmp, sizeof(tmp));
#endif
padfname(getfname(path),f.name);
padfname(getfname(tmp),f.name);
for(x=0;x<usrlibs;x++) {
for(y=0;y<usrdirs[x];y++)
......@@ -659,12 +665,9 @@ void sbbs_t::batch_upload()
if(y<usrdirs[x])
break;
}
SAFEPRINTF2(str2,"%s%s",cfg.dir[f.dir]->path,dirent->d_name);
if(x<usrlibs || fexistcase(str2)) {
if(x<usrlibs) {
bprintf(text[FileAlreadyOnline],f.name);
remove(str1);
} else {
mv(str1,str2,0);
uploadfile(&f);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment