mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-29 11:01:22 -04:00
extended character filtering to fit a common denominator for all filesystems
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5979 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
892057b53e
commit
bb7645549f
3 changed files with 16 additions and 13 deletions
|
@ -1061,14 +1061,15 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
}
|
||||
|
||||
QString cleanname = link.name() ;
|
||||
bool bad_chars = false ;
|
||||
static const QString bad_chars_str = "/\\\"*:?<>|" ;
|
||||
|
||||
for(uint32_t i=0;i<cleanname.length();++i)
|
||||
if(cleanname[i] == '/' || cleanname[i] == '\\')
|
||||
{
|
||||
cleanname[i] = '_';
|
||||
flag |= RSLINK_PROCESS_NOTIFY_BAD_CHARS ;
|
||||
}
|
||||
for(uint32_t j=0;j<bad_chars_str.length();++j)
|
||||
if(cleanname[i] == bad_chars_str[j])
|
||||
{
|
||||
cleanname[i] = '_';
|
||||
flag |= RSLINK_PROCESS_NOTIFY_BAD_CHARS ;
|
||||
}
|
||||
|
||||
if (rsFiles->FileRequest(cleanname.toUtf8().constData(), link.hash().toStdString(), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) {
|
||||
fileAdded.append(link.name());
|
||||
|
@ -1348,7 +1349,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
}
|
||||
}
|
||||
if(flag & RSLINK_PROCESS_NOTIFY_BAD_CHARS)
|
||||
result += QString("<br>%1").arg(QObject::tr("Warning: '/' and '\\' characters in some of the\nabove filenames will be replaced by '_'.")) ;
|
||||
result += QString("<br>%1").arg(QObject::tr("Warning: forbidden characters found in filenames. \nCharacters <b>\",|,/,\\,<,>,*,?</b> will be replaced by '_'.")) ;
|
||||
|
||||
if (result.isEmpty() == false) {
|
||||
QMessageBox mb(QObject::tr("Result"), "<html><body>" + result + "</body></html>", QMessageBox::Information, QMessageBox::Ok, 0, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue