Skip to content

Commit

Permalink
prevent using remote image urls in showcase
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Oct 8, 2020
1 parent 5d3765f commit d320339
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
12 changes: 11 additions & 1 deletion website-1.x/data/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

module.exports = [
const users = [
// Please add your logo in alphabetical order of caption.
{
caption: '1Hive',
Expand Down Expand Up @@ -892,3 +892,13 @@ module.exports = [

// Please add your logo in alphabetical order of caption.
];

users.forEach((user) => {
if (!user.image || !user.image.startsWith('/img/users/')) {
throw new Error(
`Bad user site image = ${user.image}. The image should be hosted on Docusaurus site, in /static/img/users/ folder, and not use remote http or https urls`,
);
}
});

module.exports = users;
12 changes: 12 additions & 0 deletions website/src/data/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,16 @@ const users = [
},
];

users.forEach((user) => {
if (
!user.preview ||
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;

0 comments on commit d320339

Please sign in to comment.