Skip to content

Commit

Permalink
Validate podcastGuid is uuid before saving
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchdowney committed Apr 10, 2024
1 parent 4cf54bd commit 9d0e334
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/services/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
podcastItunesTypeDefaultValue
} from 'podverse-shared'
import { getRepository, In, Not } from 'typeorm'
import isUUID from 'validator/lib/isUUID'
import { config } from '~/config'
import { updateSoundBites } from '~/controllers/mediaRef'
import { getPodcast } from '~/controllers/podcast'
Expand Down Expand Up @@ -371,7 +372,10 @@ export const parseFeedUrl = async (feedUrl, forceReparsing = false, cacheBust =
// guid is deprecated
podcast.guid = meta.guid
// podcastGuid is the column we want to use going forward
podcast.podcastGuid = meta.guid

if (meta.guid && isUUID(meta.guid)) {
podcast.podcastGuid = meta.guid
}

const hasNewImageUrl = meta.imageURL && podcast.imageUrl !== meta.imageURL
podcast.imageUrl = meta.imageURL
Expand Down

0 comments on commit 9d0e334

Please sign in to comment.