Skip to content

Commit 9d0e334

Browse files
committed
Validate podcastGuid is uuid before saving
1 parent 4cf54bd commit 9d0e334

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/services/parser.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
podcastItunesTypeDefaultValue
1212
} from 'podverse-shared'
1313
import { getRepository, In, Not } from 'typeorm'
14+
import isUUID from 'validator/lib/isUUID'
1415
import { config } from '~/config'
1516
import { updateSoundBites } from '~/controllers/mediaRef'
1617
import { getPodcast } from '~/controllers/podcast'
@@ -371,7 +372,10 @@ export const parseFeedUrl = async (feedUrl, forceReparsing = false, cacheBust =
371372
// guid is deprecated
372373
podcast.guid = meta.guid
373374
// podcastGuid is the column we want to use going forward
374-
podcast.podcastGuid = meta.guid
375+
376+
if (meta.guid && isUUID(meta.guid)) {
377+
podcast.podcastGuid = meta.guid
378+
}
375379

376380
const hasNewImageUrl = meta.imageURL && podcast.imageUrl !== meta.imageURL
377381
podcast.imageUrl = meta.imageURL

0 commit comments

Comments
 (0)