mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
Add global constant for torrent file content type
This commit is contained in:
parent
0b478d8190
commit
59eb3bd33b
4 changed files with 8 additions and 4 deletions
|
@ -74,6 +74,7 @@ namespace Http
|
|||
inline const QString CONTENT_TYPE_PNG = u"image/png"_s;
|
||||
inline const QString CONTENT_TYPE_FORM_ENCODED = u"application/x-www-form-urlencoded"_s;
|
||||
inline const QString CONTENT_TYPE_FORM_DATA = u"multipart/form-data"_s;
|
||||
inline const QString CONTENT_TYPE_TORRENT_FILE = u"application/x-bittorrent"_s;
|
||||
|
||||
// portability: "\r\n" doesn't guarantee mapping to the correct symbol
|
||||
inline const char CRLF[] = {0x0D, 0x0A, '\0'};
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <QXmlStreamReader>
|
||||
|
||||
#include "base/global.h"
|
||||
#include "base/http/types.h"
|
||||
#include "rss_article.h"
|
||||
|
||||
namespace
|
||||
|
@ -623,7 +624,7 @@ void RSS::Private::Parser::parseRssArticle(QXmlStreamReader &xml)
|
|||
}
|
||||
else if (name == u"enclosure")
|
||||
{
|
||||
if (xml.attributes().value(u"type"_s) == u"application/x-bittorrent")
|
||||
if (xml.attributes().value(u"type"_s) == Http::CONTENT_TYPE_TORRENT_FILE)
|
||||
article[Article::KeyTorrentURL] = xml.attributes().value(u"url"_s).toString();
|
||||
else if (xml.attributes().value(u"type"_s).isEmpty())
|
||||
altTorrentUrl = xml.attributes().value(u"url"_s).toString();
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "base/global.h"
|
||||
#include "base/bittorrent/torrentcreationmanager.h"
|
||||
#include "base/http/types.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/utils/io.h"
|
||||
#include "base/utils/string.h"
|
||||
|
@ -234,7 +235,7 @@ void TorrentCreatorController::torrentFileAction()
|
|||
if (!readResult)
|
||||
throw APIError(APIErrorType::Conflict, readResult.error().message);
|
||||
|
||||
setResult(readResult.value(), u"application/x-bittorrent"_s, (id + u".torrent"));
|
||||
setResult(readResult.value(), Http::CONTENT_TYPE_TORRENT_FILE, (id + u".torrent"));
|
||||
}
|
||||
|
||||
void TorrentCreatorController::deleteTaskAction()
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "base/bittorrent/trackerentrystatus.h"
|
||||
#include "base/interfaces/iapplication.h"
|
||||
#include "base/global.h"
|
||||
#include "base/http/types.h"
|
||||
#include "base/logger.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/torrentfilter.h"
|
||||
|
@ -1749,7 +1750,7 @@ void TorrentsController::exportAction()
|
|||
if (!result)
|
||||
throw APIError(APIErrorType::Conflict, tr("Unable to export torrent file. Error: %1").arg(result.error()));
|
||||
|
||||
setResult(result.value(), u"application/x-bittorrent"_s, (id.toString() + u".torrent"));
|
||||
setResult(result.value(), Http::CONTENT_TYPE_TORRENT_FILE, (id.toString() + u".torrent"));
|
||||
}
|
||||
|
||||
void TorrentsController::SSLParametersAction()
|
||||
|
@ -1945,7 +1946,7 @@ void TorrentsController::saveMetadataAction()
|
|||
if (!result)
|
||||
throw APIError(APIErrorType::Conflict, tr("Unable to export torrent metadata. Error: %1").arg(result.error()));
|
||||
|
||||
setResult(result.value(), u"application/x-bittorrent"_s, (infoHash.toTorrentID().toString() + u".torrent"));
|
||||
setResult(result.value(), Http::CONTENT_TYPE_TORRENT_FILE, (infoHash.toTorrentID().toString() + u".torrent"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue