mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-10-02 11:56:44 -05:00
Prevent storing invalid images
This commit is contained in:
@@ -66,6 +66,10 @@ export default class ImageProcessor
|
||||
try {
|
||||
let result = await fetch(url);
|
||||
|
||||
if (!result.ok) {
|
||||
throw new Error(`Invalid image response code: ${result.status}`);
|
||||
}
|
||||
|
||||
await mkdirp(path.dirname(this.localPath(destination)));
|
||||
await fs.writeFile(this.localPath(destination), result.body);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user