a5862659

Archive
Tree [a5862659] [>]
commit
a58626592378590db558322184a4e7c5e9719dd4
parent
author
Christopher K. Schmitt <me@shmish.dev>
date
2026-07-29
committer
Christopher K. Schmitt <me@shmish.dev>
date
2026-07-29
changes
2
insertions
22
deletions
3
Fix archive error codes and rewrite relative README links
Msrc/routes/archive.rs
~    .map_err(|e| Error::Io(std::io::Error::new(std::io::ErrorKind::Other, e)))?;~~    if !success {-        return Err(Error::NotFound(format!("archive failed: {stderr}")));+        return Err(Error::GitCorrupt(format!("archive failed: {stderr}")));~    }~~    // Strip refs/heads/ or refs/tags/ prefix for a cleaner filename.
Msrc/routes/repo.rs
~~            use pulldown_cmark::{Event, Options, Parser, Tag, html};~-            // Rewrite relative image URLs to the raw file serving route so-            // that images committed alongside the README render correctly.+            // Rewrite relative image and link URLs to the raw file serving+            // route so that assets committed alongside the README work.~            let mut rendered = String::new();~            let events = Parser::new_ext(text, Options::empty()).map(|event| match event {~                Event::Start(Tag::Image {
~                        _ => dest_url,~                    };~                    Event::Start(Tag::Image {+                        link_type,+                        dest_url,+                        title,+                        id,+                    })+                }+                Event::Start(Tag::Link {+                    link_type,+                    dest_url,+                    title,+                    id,+                }) => {+                    let dest_url = match &head_sha {+                        Some(sha) if is_relative_url(&dest_url) => {+                            format!("{}/{}/commits/{}/raw/{}", crate::base_url(), name, sha, dest_url).into()+                        }+                        _ => dest_url,+                    };+                    Event::Start(Tag::Link {~                        link_type,~                        dest_url,~                        title,