Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crates under 3/l downloaded incorrectly #83

Closed
Kepler-Br opened this issue Nov 16, 2022 · 5 comments
Closed

crates under 3/l downloaded incorrectly #83

Kepler-Br opened this issue Nov 16, 2022 · 5 comments

Comments

@Kepler-Br
Copy link

Kepler-Br commented Nov 16, 2022

% cargo install cargo-cache
    Updating `panamax` index
  Installing cargo-cache v0.8.3
error: failed to compile `cargo-cache v0.8.3`, intermediate artifacts can be found at `/tmp/cargo-installGZoqCc`

Caused by:
  failed to download from `http://crates.dw/3/l/log/0.4.17/log-0.4.17.crate`

Caused by:
  failed to get 200 response from `http://crates.dw/3/l/log/0.4.17/log-0.4.17.crate`, got 404

I've checked index and there is an index file under /3/l/log, but crates folder contains log crate under path 3/log which is not correct

I've tried with dockerized version of latest commit on master

@jbg
Copy link

jbg commented Jan 15, 2023

You can't serve the files directly without some rewrites, see the sample nginx config in the repo: https://github.com/panamax-rs/panamax/blob/master/nginx.sample.conf

I'm not sure why the decision was made to have the on-disk layout differ from the served layout. I wanted to use panamax to update a mirror which is mounted into build tasks (so the crates base URL is a file:// URL) but it doesn't work because of this same issue.

@k3d3
Copy link
Member

k3d3 commented Jan 15, 2023

Oh shoot, I didn't realize the formats differed - the intention was to have them be the same format. I could've sworn the index used to be 3/(crate) rather than 3/(1st letter) /(crate).

Ill try to get this fixed - sorry about that.

@jbg
Copy link

jbg commented Jan 16, 2023

Actually even with the rewrites in place, there seem to be issues with crates that have short names.

[16/Jan/2023:05:40:15 +0000] "GET /crates/3/n/num/0.3.1/num-0.3.1.crate HTTP/1.1" 404 153 "-" "cargo 1.66.1 (ad779e08b 2023-01-10)"

@jbg
Copy link

jbg commented Jan 16, 2023

I replaced the rewrites with this and it seems to work:

rewrite "^/crates/3/[^/]/([^/]+)/([^/]+)/([^/]+)$" "/crates/3/$1/$2/$3";

The other rewrites, so far, seem unnecessary. Maybe needed for an older cargo version?

@k3d3
Copy link
Member

k3d3 commented Feb 4, 2023

This should be fixed as of 1.0.8. Feel free to reopen this issue if you're still having trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants