mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added replacement of \ and / in filenames from RsLinks
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5978 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bf3194f035
commit
892057b53e
@ -1060,7 +1060,17 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
srcIds.push_back((*it).peerId) ;
|
||||
}
|
||||
|
||||
if (rsFiles->FileRequest(link.name().toUtf8().constData(), link.hash().toStdString(), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) {
|
||||
QString cleanname = link.name() ;
|
||||
bool bad_chars = false ;
|
||||
|
||||
for(uint32_t i=0;i<cleanname.length();++i)
|
||||
if(cleanname[i] == '/' || cleanname[i] == '\\')
|
||||
{
|
||||
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());
|
||||
} else {
|
||||
fileExist.append(link.name());
|
||||
@ -1337,6 +1347,8 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
result += QString("<br>%1: %2").arg(QObject::tr("Invalid links")).arg(countInvalid);
|
||||
}
|
||||
}
|
||||
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 '_'.")) ;
|
||||
|
||||
if (result.isEmpty() == false) {
|
||||
QMessageBox mb(QObject::tr("Result"), "<html><body>" + result + "</body></html>", QMessageBox::Information, QMessageBox::Ok, 0, 0);
|
||||
@ -1344,6 +1356,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
||||
mb.exec();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -37,9 +37,10 @@
|
||||
#include <QVector>
|
||||
#include <QUrl>
|
||||
|
||||
#define RSLINK_PROCESS_NOTIFY_SUCCESS 1 // notify on success
|
||||
#define RSLINK_PROCESS_NOTIFY_ERROR 2 // notify on error
|
||||
#define RSLINK_PROCESS_NOTIFY_ASK 4 // ask for add the links
|
||||
#define RSLINK_PROCESS_NOTIFY_SUCCESS 1 // notify on success
|
||||
#define RSLINK_PROCESS_NOTIFY_ERROR 2 // notify on error
|
||||
#define RSLINK_PROCESS_NOTIFY_ASK 4 // ask for add the links
|
||||
#define RSLINK_PROCESS_NOTIFY_BAD_CHARS 8 // / or \\ characters in a filename
|
||||
|
||||
#define RSLINK_PROCESS_NOTIFY_ALL -1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user