frewsxcv / rust-crates-index

Rust library for retrieving and interacting with the crates.io index
https://docs.rs/crates-index/
Apache License 2.0
72 stars 37 forks source link

Registry with port crates the wrong directory #83

Closed epage closed 2 years ago

epage commented 2 years ago

From https://github.com/killercup/cargo-edit/issues/758

If using a custom registry that has a port specified the cargo-upgrade upgrade command will fail due to attempting to create a directory with a ':' in the name. It looks like cargo strips out the port when creating directories in the registry. The cargo-edit command should do the same.

$ cargo-upgrade upgrade Error: failed to make directory 'C:\Users\mrichar2.cargo\registry/index\myregistry.com:8081-0224531983076253': The directory name is invalid. ; class=Os (2) Caused by: failed to make directory 'C:\Users\mrichar2.cargo\registry/index\myregistry.com:8081-0224531983076253': The directory name is invalid. ; class=Os (2)

~/.cargo/config.toml:

[registry]
default = "artifactory"

[registries.artifactory]
index = "http://myregistry.com:8081/artifactory/git/crates-remote.git"

[source.artifactory]
registry = "http://myregistry.com:8081/artifactory/git/crates-remote.git"

[source.crates-io]
replace-with = "artifactory"

The index directory appears to be named "myregistry.com-0224531983076253" instead of "myregistry.com:8081-0224531983076253"