Describe the bug
When putting a resource pack zipped on MacOS (although this could apply to other OSes as well), Geyser will fail to read them.
This code is the core of the issue:
stream.forEach(x -> {
String name = x.getName();
// ...
if (name.contains("manifest.json")) {
try {
var stream2 = zip.getInputStream(x);
var bytes = stream2.readAllBytes();
System.out.println(Arrays.toString(bytes));
GeyserResourcePackManifest manifest = FileUtils.loadJson(zip.getInputStream(x), GeyserResourcePackManifest.class);
if (manifest.header().uuid() != null) {
manifestReference.set(manifest);
}
} catch (IOException e) {
e.printStackTrace();
}
}
});
Once a successful manifest is read, Geyser keeps trying to read more manifests. However, once a failed manifest is read, Geyser marks the entire pack as invalid, and ignores it, even if it found a successful manifest before. MacOS's compress tool was triggering this since it creates metadata files in the __MACOSX folder (__MACOSX/_manifest.json in this case), which Geyser was detecting as a valid manifest.json, even after it found the correct manifest.json. However, since that metadata isn't valid JSON, the parser throws an exception.
To Reproduce
Put pack.zip into the plugins/Geyser-Spigot/packs/ folder, and run the server. An error will occur with an error message similar to "The resource pack plugins/Geyser-Spigot/packs/pack.zip is invalid and failed to load!"
Expected behaviour
The pack should successfully load.
Screenshots / Videos
No response
Server Version and Plugins
No response
Geyser Dump
No response
Geyser Version
1230, but the bug exists on the master branch too
Minecraft: Bedrock Edition Device/Version
No response
Additional Context
There are a few ways to fix this issue:
- Skip
__MACOSX folder when looking for manifest.json (Doesn't solve the root issue, other OSes/tools might use similar metadata structures)
- Improve
manifest.json detection (Best option, but difficult to implement without being to stingy)
- Don't fail fast when searching for
manifest.json
- Succeed fast when searching for
manifest.json
I will submit a PR implementing the last two.
Describe the bug
When putting a resource pack zipped on MacOS (although this could apply to other OSes as well), Geyser will fail to read them.
This code is the core of the issue:
Once a successful manifest is read, Geyser keeps trying to read more manifests. However, once a failed manifest is read, Geyser marks the entire pack as invalid, and ignores it, even if it found a successful manifest before. MacOS's compress tool was triggering this since it creates metadata files in the
__MACOSXfolder (__MACOSX/_manifest.jsonin this case), which Geyser was detecting as a valid manifest.json, even after it found the correctmanifest.json. However, since that metadata isn't valid JSON, the parser throws an exception.To Reproduce
Put pack.zip into the
plugins/Geyser-Spigot/packs/folder, and run the server. An error will occur with an error message similar to "The resource pack plugins/Geyser-Spigot/packs/pack.zip is invalid and failed to load!"Expected behaviour
The pack should successfully load.
Screenshots / Videos
No response
Server Version and Plugins
No response
Geyser Dump
No response
Geyser Version
1230, but the bug exists on the master branch too
Minecraft: Bedrock Edition Device/Version
No response
Additional Context
There are a few ways to fix this issue:
__MACOSXfolder when looking formanifest.json(Doesn't solve the root issue, other OSes/tools might use similar metadata structures)manifest.jsondetection (Best option, but difficult to implement without being to stingy)manifest.jsonmanifest.jsonI will submit a PR implementing the last two.