mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
validate feed url before adding
This commit is contained in:
parent
d2c17f7539
commit
c2a084803a
1 changed files with 10 additions and 0 deletions
|
|
@ -39,6 +39,7 @@ import {
|
|||
} from '../../generated/graphql'
|
||||
import { getRepository } from '../../repository'
|
||||
import { feedRepository } from '../../repository/feed'
|
||||
import { validateUrl } from '../../services/create_page_save_request'
|
||||
import { unsubscribe } from '../../services/subscriptions'
|
||||
import { Merge } from '../../util'
|
||||
import { analytics } from '../../utils/analytics'
|
||||
|
|
@ -201,6 +202,15 @@ export const subscribeResolver = authorized<
|
|||
}
|
||||
}
|
||||
const feedUrl = feed.url
|
||||
try {
|
||||
validateUrl(feedUrl)
|
||||
} catch (error) {
|
||||
log.error('invalid feedUrl', { feedUrl, error })
|
||||
|
||||
return {
|
||||
errorCodes: [SubscribeErrorCode.BadRequest],
|
||||
}
|
||||
}
|
||||
|
||||
// find existing subscription
|
||||
const existingSubscription = await getRepository(Subscription).findOneBy({
|
||||
|
|
|
|||
Loading…
Reference in a new issue