feat(v2): prevent using remote image urls in showcase (#3560)

* prevent using remote image urls in showcase

* remove old/duplicate user image self-hosted check

* fix unavailable str.startsWith

* fix external image check due to ideal-image plugin

* fix external image check due to ideal-image plugin
This commit is contained in:
Sébastien Lorber 2020-10-08 18:40:41 +02:00 committed by GitHub
parent d444ab75ef
commit a3ab9c116f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 10 deletions

View file

@ -269,4 +269,16 @@ const users = [
},
];
users.forEach((user) => {
if (
!user.preview ||
(user.preview instanceof String &&
(user.preview.startsWith('http') || user.preview.startsWith('//')))
) {
throw new Error(
`Bad user site image preview = ${user.preview}. The image should be hosted on Docusaurus site, and not use remote http or https urls`,
);
}
});
export default users;