Handle dist info casing mismatch in worker (#273)

The metadata name may be uppercase, while the wheel and dist info names
are lowercase, or the metadata name and the dist info name are
lowercase, while the wheel name is uppercase. Either way, we just search
the wheel for the name. See `find_dist_info`:
2652caa3e3/crates/install-wheel-rs/src/wheel.rs (L1024-L1057)

I tested this with `wrangler dev` and `bio_embeddings[all]`
This commit is contained in:
konsti 2023-11-02 12:04:28 +01:00 committed by GitHub
parent 9488804024
commit 8a8b532330
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,8 +73,14 @@ async function readMetadata(
version: string,
) {
const entries = await reader.getEntriesGenerator();
const target = `${name}-${version}.dist-info/METADATA`.toLowerCase();
for await (const entry of entries) {
if (entry.filename == `${name}-${version}.dist-info/METADATA`) {
// The metadata name may be uppercase, while the wheel and dist info names are lowercase, or
// the metadata name and the dist info name are lowercase, while the wheel name is uppercase.
// Either way, we just search the wheel for the name. See `find_dist_info`:
// https://github.com/astral-sh/puffin/blob/2652caa3e31282afc2f1e1ca581ac4f553af710d/crates/install-wheel-rs/src/wheel.rs#L1024-L1057
if (entry.filename.toLowerCase() == target) {
return await entry.getData!(new zip.TextWriter());
}
}