Skip to content

Commit

Permalink
Fix Image Downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBrokenRail committed Oct 19, 2023
1 parent 43f074b commit 9a218d1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,18 @@ async function processSkin(imageUrl: string) {
console.log(`IMAGE: ${imageUrl}`);

// Download Image
const response = await fetch(imageUrl);
console.log(`DEBUG A: ${response}`);
const response = await fetch(imageUrl, {
headers: {
Authorization: `Bearer ${process.env['GITHUB_TOKEN']}`
}
});
if (response.status !== 200) {
// Failed To Download Image
finish('Unable to downlaod skin!');
return;
}
const arrayBuffer = await response.arrayBuffer();
console.log(`DEBUG B: ${arrayBuffer}`);
const buffer = Buffer.from(arrayBuffer);
console.log(`DEBUG C: ${buffer}`);

// Check Image Size
const image = await Jimp.read(buffer);
Expand Down

0 comments on commit 9a218d1

Please sign in to comment.