File tree Expand file tree Collapse file tree
sanityv3/schemas/validations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,18 +52,21 @@ export const warnHttpOrNotValidSlugExternal = (slug: string) => {
5252 const isHttp = httpRegex . test ( slug )
5353 const validSlug = stringIsSlug . test ( slug )
5454 const slugWithOutQueryParam = slug . split ( '?' ) [ 0 ]
55+ const isPotentialArchivedNewsUrl = isEquinorUrl ( slug ) && Flags . HAS_ARCHIVED_NEWS && slug . includes ( "/news" )
5556 const isInvalidEquinorUrl = slugWithOutQueryParam !== slugWithOutQueryParam . toLowerCase ( ) && isEquinorUrl ( slug )
5657
57- let message = ''
5858 if ( isHttp ) {
59- message = 'Use https in url. '
59+ return 'Use https in url. '
6060 }
6161 if ( ! validSlug ) {
62- message = message . concat ( `Not a valid url.` )
62+ return `Not a valid url.`
63+ }
64+ if ( isPotentialArchivedNewsUrl ) {
65+ return true
6366 }
6467
6568 if ( isInvalidEquinorUrl ) {
66- message = message . concat ( 'Equinor urls should contain lowercase letters only.' )
69+ return 'Equinor urls should contain lowercase letters only.'
6770 }
68- return isHttp || ! validSlug || isInvalidEquinorUrl ? message : true
71+ return true
6972}
You can’t perform that action at this time.
0 commit comments