Replaced spaces with %20 in RetroShare links.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4649 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-10-22 11:15:30 +00:00
parent c8ea41a4db
commit 8e40fd6360

View File

@ -444,6 +444,11 @@ QString RetroShareLink::title() const
return "";
}
static QString encodeItem(QString item)
{
return item.replace(" ", "%20");
}
QString RetroShareLink::toString() const
{
switch (_type) {
@ -454,7 +459,7 @@ QString RetroShareLink::toString() const
QUrl url;
url.setScheme(RSLINK_SCHEME);
url.setHost(HOST_FILE);
url.addQueryItem(FILE_NAME, _name);
url.addQueryItem(FILE_NAME, encodeItem(_name));
url.addQueryItem(FILE_SIZE, QString::number(_size));
url.addQueryItem(FILE_HASH, _hash);
@ -465,7 +470,7 @@ QString RetroShareLink::toString() const
QUrl url;
url.setScheme(RSLINK_SCHEME);
url.setHost(HOST_PERSON);
url.addQueryItem(PERSON_NAME, _name);
url.addQueryItem(PERSON_NAME, encodeItem(_name));
url.addQueryItem(PERSON_HASH, _hash);
return url.toString();
@ -475,7 +480,7 @@ QString RetroShareLink::toString() const
QUrl url;
url.setScheme(RSLINK_SCHEME);
url.setHost(HOST_FORUM);
url.addQueryItem(FORUM_NAME, _name);
url.addQueryItem(FORUM_NAME, encodeItem(_name));
url.addQueryItem(FORUM_ID, _hash);
if (!_msgId.isEmpty()) {
url.addQueryItem(FORUM_MSGID, _msgId);
@ -488,7 +493,7 @@ QString RetroShareLink::toString() const
QUrl url;
url.setScheme(RSLINK_SCHEME);
url.setHost(HOST_CHANNEL);
url.addQueryItem(CHANNEL_NAME, _name);
url.addQueryItem(CHANNEL_NAME, encodeItem(_name));
url.addQueryItem(CHANNEL_ID, _hash);
if (!_msgId.isEmpty()) {
url.addQueryItem(CHANNEL_MSGID, _msgId);
@ -501,7 +506,7 @@ QString RetroShareLink::toString() const
QUrl url;
url.setScheme(RSLINK_SCHEME);
url.setHost(HOST_SEARCH);
url.addQueryItem(SEARCH_KEYWORDS, _name);
url.addQueryItem(SEARCH_KEYWORDS, encodeItem(_name));
return url.toString();
}
@ -512,7 +517,7 @@ QString RetroShareLink::toString() const
url.setHost(HOST_MESSAGE);
url.addQueryItem(MESSAGE_ID, _hash);
if (_subject.isEmpty() == false) {
url.addQueryItem(MESSAGE_SUBJECT, _subject);
url.addQueryItem(MESSAGE_SUBJECT, encodeItem(_subject));
}
return url.toString();