ZippedResourcePack: ensure non-empty file

ZipArchive raises deprecation errors on empty files for some reason
This commit is contained in:
Dylan K. Taylor 2022-04-17 20:32:23 +01:00
parent 4c9d2a989e
commit 52e3f1e269
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -64,6 +64,13 @@ class ZippedResourcePack implements ResourcePack{
if(!file_exists($zipPath)){
throw new ResourcePackException("File not found");
}
$size = filesize($zipPath);
if($size === false){
throw new ResourcePackException("Unable to determine size of file");
}
if($size === 0){
throw new ResourcePackException("Empty file, probably corrupted");
}
$archive = new \ZipArchive();
if(($openResult = $archive->open($zipPath)) !== true){