File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,14 @@ export class Directives {
146
146
const [ , handle , suffix ] = source . match ( / ^ ( .* ! ) ( [ ^ ! ] * ) $ / ) as string [ ]
147
147
if ( ! suffix ) onError ( `The ${ source } tag has no suffix` )
148
148
const prefix = this . tags [ handle ]
149
- if ( prefix ) return prefix + decodeURIComponent ( suffix )
149
+ if ( prefix ) {
150
+ try {
151
+ return prefix + decodeURIComponent ( suffix )
152
+ } catch ( error ) {
153
+ onError ( String ( error ) )
154
+ return null
155
+ }
156
+ }
150
157
if ( handle === '!' ) return source // local tag
151
158
152
159
onError ( `Could not resolve tag: ${ source } ` )
Original file line number Diff line number Diff line change @@ -106,6 +106,12 @@ describe('tags', () => {
106
106
expect ( doc . errors [ 0 ] . code ) . toBe ( 'MISSING_CHAR' )
107
107
} )
108
108
}
109
+
110
+ test ( 'malformed URI (eemeli/yaml#498)' , ( ) => {
111
+ const doc = parseDocument ( '!!%ee 0' )
112
+ expect ( doc . errors ) . toHaveLength ( 1 )
113
+ expect ( doc . errors [ 0 ] . message ) . toMatch ( 'URIError' )
114
+ } )
109
115
} )
110
116
111
117
test ( 'eemeli/yaml#97' , ( ) => {
You can’t perform that action at this time.
0 commit comments