File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -290,10 +290,16 @@ export default class WebPlatform {
290290 }
291291 } else if ( this . _imageWorker ) {
292292 // WPE-specific image parser.
293- // image urls can be like "//example.com/image.png"
294- if ( typeof src !== 'string' || ( src . indexOf ( '://' ) < 0 && ! src . startsWith ( '//' ) ) ) {
293+ if ( typeof src !== 'string' ) {
295294 return cb ( "Invalid image URL" ) ;
296295 }
296+
297+ // URL can start with http://, https://, and //
298+ const separatorPos = src . indexOf ( '//' ) ;
299+ if ( separatorPos !== 0 && separatorPos !== 5 && separatorPos !== 6 ) {
300+ return cb ( "Invalid image URL" ) ;
301+ }
302+
297303 const image = this . _imageWorker . create ( src ) ;
298304 image . onError = function ( err ) {
299305 return cb ( "Image load error" ) ;
You can’t perform that action at this time.
0 commit comments