Skip to content

Commit

Permalink
fix(docs): download all kinds of images on vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
BroKun committed Nov 15, 2024
1 parent 4e04e90 commit 158cbd9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/docs/dumi-plugin-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ async function downloadResource(url, destination) {
// httpsAgent: new (require('https').Agent)({ rejectUnauthorized: false })
});

if (response.headers['content-type'] !== 'image/gif') {
const contentType = response.headers['content-type'];
const allowedContentTypes = ['image/gif', 'image/png', 'image/jpeg'];

if (!allowedContentTypes.includes(contentType)) {
throw new Error(
`Expected image/gif but received ${response.headers['content-type']}`,
`Unsupported content type: ${contentType}. Expected one of ${allowedContentTypes.join(', ')}.`,
);
}

Expand Down

0 comments on commit 158cbd9

Please sign in to comment.