mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-21 07:20:28 -04:00
added proper filtering of slash and backshash from directory and file names in RsCollection to avoid files that can be redirected to wrong locations
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5977 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8078ad3aab
commit
bf3194f035
3 changed files with 40 additions and 6 deletions
|
@ -52,6 +52,7 @@ RsCollectionDialog::RsCollectionDialog(const QString& CollectionFileName,const s
|
|||
|
||||
uint64_t total_size ;
|
||||
uint32_t total_files ;
|
||||
bool wrong_chars = false ;
|
||||
|
||||
for(uint32_t i=0;i<size;++i)
|
||||
{
|
||||
|
@ -66,6 +67,12 @@ RsCollectionDialog::RsCollectionDialog(const QString& CollectionFileName,const s
|
|||
item->setText(1, misc::friendlyUnit(dlinfo.size));
|
||||
item->setText(2, dlinfo.hash);
|
||||
|
||||
if(dlinfo.filename_has_wrong_characters)
|
||||
{
|
||||
wrong_chars = true ;
|
||||
item->setTextColor(0,QColor(255,80,120)) ;
|
||||
}
|
||||
|
||||
_fileEntriesTW->addTopLevelItem(item);
|
||||
|
||||
total_size += dlinfo.size ;
|
||||
|
@ -88,6 +95,9 @@ RsCollectionDialog::RsCollectionDialog(const QString& CollectionFileName,const s
|
|||
connect(_download_PB,SIGNAL(clicked()),this,SLOT(download())) ;
|
||||
|
||||
_fileEntriesTW->installEventFilter(this);
|
||||
|
||||
if(wrong_chars)
|
||||
QMessageBox::warning(NULL,tr("Bad filenames have been cleaned"),tr("Some filenames or directory names in this collection file\ncontained '/' or '\\' characters. They have been substitued to '_',\nand are listed in red.")) ;
|
||||
}
|
||||
|
||||
bool RsCollectionDialog::eventFilter(QObject *obj, QEvent *event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue