mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 17:51:54 +00:00
[bugfix] Utils: <is-src> data URLs should be prefixed with the data:image (#3308)
This commit is contained in:
@@ -88,4 +88,5 @@ test('is-src', () => {
|
||||
expect(isSrc('')).toBeFalsy();
|
||||
expect(isSrc('blob:http://img.cdn.com')).toBeTruthy();
|
||||
expect(isSrc('blob:https://img.cdn.com')).toBeTruthy();
|
||||
expect(isSrc('xdata:image/jpeg;base64,/9j/4AAQSkZ')).toBeFalsy();
|
||||
});
|
||||
|
@@ -2,5 +2,5 @@
|
||||
* Is image source
|
||||
*/
|
||||
export function isSrc(url: string): boolean {
|
||||
return /^((blob:)?https?:)?\/\/|data:image/.test(url);
|
||||
return /^(((blob:)?https?:)?\/\/|data:image)/.test(url);
|
||||
}
|
||||
|
Reference in New Issue
Block a user