Use QFileInfo::path instead of QUrl::RemoveFilename

This commit is contained in:
Jonas Kvinge 2023-06-15 21:06:18 +02:00
parent b87a950357
commit 354b55cbbc
2 changed files with 3 additions and 2 deletions

View File

@ -642,7 +642,7 @@ QUrl AlbumCoverChoiceController::SaveCoverToFileAutomatic(const Song *song, cons
song->effective_albumartist(),
song->effective_album(),
song->album_id(),
song->url().adjusted(QUrl::RemoveFilename).path(),
QFileInfo(song->url().toLocalFile()).path(),
result,
force_overwrite);

View File

@ -33,6 +33,7 @@
#include <QScreen>
#include <QItemSelectionModel>
#include <QListWidgetItem>
#include <QFileInfo>
#include <QFile>
#include <QSet>
#include <QVariant>
@ -965,7 +966,7 @@ void AlbumCoverManager::SaveAndSetCover(AlbumItem *album_item, const AlbumCoverI
cover_url = result.cover_url;
}
else if (!result.image_data.isEmpty() || !result.image.isNull()) {
cover_url = album_cover_choice_controller_->SaveCoverToFileAutomatic(Song::Source::Collection, albumartist, album, QString(), urls.first().adjusted(QUrl::RemoveFilename).path(), result, false);
cover_url = album_cover_choice_controller_->SaveCoverToFileAutomatic(Song::Source::Collection, albumartist, album, QString(), QFileInfo(urls.first().toLocalFile()).path(), result, false);
}
if (cover_url.isEmpty()) return;