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

Workspaced crate READMEs do not display relative images correctly #5318

Closed
redstrate opened this issue Oct 12, 2022 · 1 comment
Closed

Workspaced crate READMEs do not display relative images correctly #5318

redstrate opened this issue Oct 12, 2022 · 1 comment
Labels
A-backend ⚙️ C-bug 🐞 Category: unintended, undesired behavior

Comments

@redstrate
Copy link

Current Behavior

Viewing the README of a crate that is originally from a workspace (take imgui-rs as an example) the image is not found. This is specifically member crates that share a README from the parent folder, and relatively references images in that location.

Expected Behavior

The image should be loaded correctly.

Steps To Reproduce

  1. Go to the imgui-rs crates.io page.

Environment

  • Browser: Safari 16.0
  • OS: macOS 12.6

Anything else?

I believe I know the crux of this issue. Take a look at this snippet I have:

At around line 206 in lib.rs:

new_url += if is_media { "raw/HEAD" } else { "blob/HEAD" };
if !self.base_dir.is_empty() {
    new_url += "/";
    new_url += &self.base_dir;
}

For reference, the URL generated currently is this:

https://github.com/imgui-rs/imgui-rs/raw/HEAD/../hello_world.png

Obviously, it's trying to append base_dir (which because this is a workspace crate, I'm assuming is ..) but GitHub clearly doesn't like that. Removing the .. and just writing:

https://github.com/imgui-rs/imgui-rs/raw/HEAD/hello_world.png

Does work! So I wonder if this routine should be modified, so we collapse .. if needed. See imgui's Cargo.toml for how this happened:

[package]
name = "imgui"
readme = "../README.markdown"

I can write up a quick PR to fix this myself, but I wanted to know if there's any kind of weird edge case this code was supposed to be handling.

@redstrate redstrate added the C-bug 🐞 Category: unintended, undesired behavior label Oct 12, 2022
@Turbo87
Copy link
Member

Turbo87 commented Oct 13, 2022

hmm... looking at https://github.com/imgui-rs/imgui-rs/tree/main/imgui, the image also does not appear to render correctly because in the symlinked README the path is actually incorrect 😅

with readme = "../README.markdown" this should be irrelevant though and probably still work. the path resolution has decent test coverage iirc, so if you do find a way to fix this with a PR I'd be happy to take a look and hopefully merge it :)

@Turbo87 Turbo87 closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-bug 🐞 Category: unintended, undesired behavior
Projects
None yet
Development

No branches or pull requests

2 participants