We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3905ce1 commit aa93d20Copy full SHA for aa93d20
src/pages/api/listenbrainz/cover.ts
@@ -32,7 +32,9 @@ export const GET: APIRoute = async ({ url }) => {
32
const imageUrl = url.searchParams.get('url');
33
const wantBlurhash = url.searchParams.get('blurhash') === 'true';
34
35
- if (!imageUrl || !/^https?:\/\//.test(imageUrl)) {
+ // Only allow Cover Art Archive URLs
36
+ const coverArtArchivePattern = /^https?:\/\/(?:[^.]+\.)?coverartarchive\.org\//i;
37
+ if (!imageUrl || !coverArtArchivePattern.test(imageUrl)) {
38
return new Response('Missing or invalid url parameter', { status: 400 });
39
}
40
0 commit comments