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

Images in readme have crate name incorrectly injected into URL #9886

Closed
michaelvlach opened this issue Nov 10, 2024 · 3 comments
Closed

Images in readme have crate name incorrectly injected into URL #9886

michaelvlach opened this issue Nov 10, 2024 · 3 comments

Comments

@michaelvlach
Copy link

Current Behavior

E.g.

https://crates.io/crates/agdb

Images in any of the following forms:

<img width="100" src="./agdb_web/public/images/db.png"
<img width="100" src="/agdb_web/public/images/db.png"
<img width="100" src="agdb_web/public/images/db.png"

Will result in incorrect URL:

https://github.com/agnesoft/agdb/raw/HEAD/agdb/agdb_web/public/images/db.png

The name of the crate is wrongly inserted after the HEAD part.

Expected Behavior

The URL does not have the crate name injected after HEAD part.

Steps To Reproduce

  1. Go to https://crates.io/crates/agdb
  2. Inspect any element of the images not being found.
  3. See incorrect URL.

Environment

  • Browser: any
  • OS: any

Anything else?

No response

@Turbo87
Copy link
Member

Turbo87 commented Nov 10, 2024

This is an unfortunate consequence of using ../README.md in the Cargo.toml file (see https://github.com/agnesoft/agdb/blob/v0.9.2/agdb/Cargo.toml) in combination with relative paths in that markdown document.

Upon publish, cargo transforms that to README.md (see https://docs.rs/crate/agdb/0.9.2/source/Cargo.toml#41) and records that the crate can be found in the agdb folder of the repository (see https://docs.rs/crate/agdb/0.9.2/source/.cargo_vcs_info.json#5). crates.io assumes that all relative paths in the README are relative to the readme field location in the Cargo.toml file, which causes our code to append the agdb prefix.

your options are either to use absolute URLs in the document, or to move/copy the document into the agdb folder and adjust the relative paths accordingly.

@michaelvlach
Copy link
Author

michaelvlach commented Nov 10, 2024

Thanks for the clartification. Would symlink work in this case? Putting just README.md in Cargo.toml and then having a symlink (not actual file) to the root? I would have to create a release just to test it out so perhaps you would know. Thanks!

@Turbo87
Copy link
Member

Turbo87 commented Nov 10, 2024

Would symlink work in this case?

if I remember correctly, this will ultimately result in a similar issue due to the factors mentioned above. sorry :-/

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

2 participants