Sanitize MBID usage: do not trust MBID coming from files' metadata

This commit is contained in:
emeric
2020-02-08 12:38:28 +01:00
parent a4bcd3bbaa
commit 52a0f62491
25 changed files with 298 additions and 132 deletions
+3 -2
View File
@@ -934,8 +934,9 @@ handleGetArtistInfoRequestCommon(RequestContext& context, bool id3)
if (!artist)
throw RequestedDataNotFoundError {};
if (!artist->getMBID().empty())
artistInfoNode.createChild("musicBrainzId").setValue(artist->getMBID());
std::optional<UUID> artistMBID {artist->getMBID()};
if (artistMBID)
artistInfoNode.createChild("musicBrainzId").setValue(artistMBID->getAsString());
}
auto similarArtistsId {ServiceProvider<Similarity::Searcher>::get()->getSimilarArtists(context.dbSession, id.value, count)};