Strip mimetype when downloading covers
This commit is contained in:
parent
548f8bf23e
commit
e6f50e6637
@ -326,6 +326,9 @@ void AlbumCoverFetcherSearch::ProviderCoverFetchFinished(QNetworkReply *reply) {
|
||||
}
|
||||
else {
|
||||
QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString();
|
||||
if (mimetype.contains(';')) {
|
||||
mimetype = mimetype.left(mimetype.indexOf(';'));
|
||||
}
|
||||
if (ImageUtils::SupportedImageMimeTypes().contains(mimetype, Qt::CaseInsensitive) || ImageUtils::SupportedImageFormats().contains(mimetype, Qt::CaseInsensitive)) {
|
||||
QByteArray image_data = reply->readAll();
|
||||
QString mime_type = Utilities::MimeTypeFromData(image_data);
|
||||
|
@ -1233,6 +1233,9 @@ void QobuzRequest::AlbumCoverReceived(QNetworkReply *reply, const QUrl &cover_ur
|
||||
}
|
||||
|
||||
QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString();
|
||||
if (mimetype.contains(';')) {
|
||||
mimetype = mimetype.left(mimetype.indexOf(';'));
|
||||
}
|
||||
if (!ImageUtils::SupportedImageMimeTypes().contains(mimetype, Qt::CaseInsensitive) && !ImageUtils::SupportedImageFormats().contains(mimetype, Qt::CaseInsensitive)) {
|
||||
Error(QString("Unsupported mimetype for image reader %1 for %2").arg(mimetype, cover_url.toString()));
|
||||
if (album_covers_requests_sent_.contains(cover_url)) album_covers_requests_sent_.remove(cover_url);
|
||||
|
@ -788,6 +788,9 @@ void SubsonicRequest::AlbumCoverReceived(QNetworkReply *reply, const QUrl url, c
|
||||
}
|
||||
|
||||
QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString();
|
||||
if (mimetype.contains(';')) {
|
||||
mimetype = mimetype.left(mimetype.indexOf(';'));
|
||||
}
|
||||
if (!ImageUtils::SupportedImageMimeTypes().contains(mimetype, Qt::CaseInsensitive) && !ImageUtils::SupportedImageFormats().contains(mimetype, Qt::CaseInsensitive)) {
|
||||
Error(QString("Unsupported mimetype for image reader %1 for %2").arg(mimetype, url.toString()));
|
||||
if (album_covers_requests_sent_.contains(url)) album_covers_requests_sent_.remove(url);
|
||||
|
@ -1187,6 +1187,9 @@ void TidalRequest::AlbumCoverReceived(QNetworkReply *reply, const QString &album
|
||||
}
|
||||
|
||||
QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString();
|
||||
if (mimetype.contains(';')) {
|
||||
mimetype = mimetype.left(mimetype.indexOf(';'));
|
||||
}
|
||||
if (!ImageUtils::SupportedImageMimeTypes().contains(mimetype, Qt::CaseInsensitive) && !ImageUtils::SupportedImageFormats().contains(mimetype, Qt::CaseInsensitive)) {
|
||||
Error(QString("Unsupported mimetype for image reader %1 for %2").arg(mimetype, url.toString()));
|
||||
if (album_covers_requests_sent_.contains(album_id)) album_covers_requests_sent_.remove(album_id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user