neiam
/gitgud
Git Gud
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
1
Log in to mark this repository.
Pin that a + in an RPM version survives the index href
ec2cfdc · Gabriel Morell · 2026-09-14 04:31
Message
{commit_body(@commit)}
Files changed
modified
test/git_gud_web/rpm_namespace_test.exs
+19
−0
@@ -144,6 +144,25 @@ defmodule GitGudWeb.RpmNamespaceTest do
| 144 | 144 | end |
| 145 | 145 | end |
| 146 | 146 | |
| 147 | + describe "a version with a + in it" do | |
| 148 | + test "round-trips from the index href to the blob", %{conn: conn, tools: tools, root: root} do | |
| 149 | + # CI stamps untagged builds `<version>+dev.<unix>`, because RPM | |
| 150 | + # forbids `-` in a version and `+` sorts after the bare release. | |
| 151 | + # That puts a `+` in every filename a dev build publishes, and a | |
| 152 | + # `+` is literal in a URI path but means a space in a query | |
| 153 | + # string — so this is exactly the character that gets mangled by | |
| 154 | + # one layer decoding a path as if it were a form. | |
| 155 | + body = publish(tools, "koco", "0.1.2+dev.1757000000") | |
| 156 | + | |
| 157 | + xml = primary(conn, root) | |
| 158 | + assert [_, href] = Regex.run(~r/<location href="([^"]+)"/, xml) | |
| 159 | + assert href =~ "+dev." | |
| 160 | + | |
| 161 | + # Fetched as the index advertises it, not as a hand-written path. | |
| 162 | + assert conn |> get(root <> "/" <> href) |> response(200) == body | |
| 163 | + end | |
| 164 | + end | |
| 165 | + | |
| 147 | 166 | describe "visibility" do |
| 148 | 167 | test "an anonymous client's index omits the private repository", %{ |
| 149 | 168 | conn: conn, |
Parents: acf6e23