scripts: set correct content-type when uploading image (#47263)

* scripts: set correct content-type when uploading image

* chore: update
This commit is contained in:
vagusX 2024-01-31 18:39:58 +08:00 committed by GitHub
parent f1f4788e38
commit 057e81f11d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,6 +93,10 @@ async function uploadFile(client, filePath, refValue) {
// https://help.aliyun.com/zh/oss/developer-reference/prevent-objects-from-being-overwritten-by-objects-that-have-the-same-names-3
'x-oss-forbid-overwrite': 'false',
};
// Set content-type to allow individual preview of images
if (path.extname(filePath) === '.png') {
headers['Content-Type'] = 'image/png';
}
console.log('Uploading file: %s', filePath);
try {