File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,15 @@ describe('SafeUrlSchema', () => {
23
23
24
24
it ( 'rejects invalid URLs' , ( ) => {
25
25
expect ( ( ) => SafeUrlSchema . parse ( 'not-a-url' ) ) . toThrow ( ) ;
26
- expect ( ( ) => SafeUrlSchema . parse ( '' ) ) . toThrow ( ) ;
27
26
} ) ;
28
27
29
28
it ( 'works with safeParse' , ( ) => {
30
29
expect ( ( ) => SafeUrlSchema . safeParse ( 'not-a-url' ) ) . not . toThrow ( ) ;
31
30
} ) ;
31
+
32
+ it ( 'works with empty string' , ( ) => {
33
+ expect ( ( ) => SafeUrlSchema . parse ( '' ) ) . not . toThrow ( ) ;
34
+ } ) ;
32
35
} ) ;
33
36
34
37
describe ( 'OAuthMetadataSchema' , ( ) => {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export const SafeUrlSchema = z.string().url()
20
20
return u . protocol !== 'javascript:' && u . protocol !== 'data:' && u . protocol !== 'vbscript:' ;
21
21
} ,
22
22
{ message : "URL cannot use javascript:, data:, or vbscript: scheme" }
23
- ) ;
23
+ ) . or ( z . literal ( "" ) ) ;
24
24
25
25
26
26
/**
You can’t perform that action at this time.
0 commit comments