Fix forwarded email subject being treated as an URL, for example "Fwd: subject"

This commit is contained in:
Hongbo Wu 2023-04-24 21:16:44 +08:00
parent b891e547c9
commit 3841734deb

View file

@ -18,6 +18,7 @@ import {
} from '../generated/graphql'
import { CreateArticlesSuccessPartial } from '../resolvers'
import { Claims, WithDataSourcesContext } from '../resolvers/types'
import { validateUrl } from '../services/create_page_save_request'
import { Merge } from '../util'
interface InputObject {
@ -292,9 +293,10 @@ export const unescapeHtml = (html: string): string => {
export const isUrl = (str: string): boolean => {
try {
new URL(str)
validateUrl(str)
return true
} catch {
console.log('not an url', str)
return false
}
}