mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Utils: <is-src> data URLs should be prefixed with the data:image (#3308)
This commit is contained in:
parent
6961e4efb0
commit
48d47cc1e0
@ -88,4 +88,5 @@ test('is-src', () => {
|
|||||||
expect(isSrc('')).toBeFalsy();
|
expect(isSrc('')).toBeFalsy();
|
||||||
expect(isSrc('blob:http://img.cdn.com')).toBeTruthy();
|
expect(isSrc('blob:http://img.cdn.com')).toBeTruthy();
|
||||||
expect(isSrc('blob:https://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
|
* Is image source
|
||||||
*/
|
*/
|
||||||
export function isSrc(url: string): boolean {
|
export function isSrc(url: string): boolean {
|
||||||
return /^((blob:)?https?:)?\/\/|data:image/.test(url);
|
return /^(((blob:)?https?:)?\/\/|data:image)/.test(url);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user