vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Name a binary file in the diff parser
ffbcb4cca7f6f7ac70ee3357ee519ef82d26173a · Keenan Nemetz · 11d ago · parent bd9ebad9
Name a binary file in the diff parser A file's old and new name came only from the ---/+++ pair, which git does not print for a binary file: it prints "Binary files ... differ" instead. A pure rename has neither. So every real PNG, STL or woff2 reached the page with no path at all. The commit page and a change request's Files tab hid that by falling back to the changed-file inventory row, which has the paths. The compare view renders what the parser produced, so there a picture had no name, no raw URL to fetch and no preview: an unnamed "Binary file: no line diff" section. Read both names from the diff --git header, which every file has, and take the absent side of an addition or deletion from its mode line so an added image does not ask for a "before" blob that never existed. Quoting is per name, so either side may be quoted while the other is not. The media fixture was "PNG" bytes with no NUL, so git called it text and the existing compare and request image tests never touched the binary path. It is binary now, which is the case a real PNG hits.
server/media_test.go +4−1
| @@ -17,7 +17,10 @@ import ( | |||
| 17 | 17 | ||
| 18 | 18 | // png stands in for an image. Nothing decodes it on the server, which is the | |
| 19 | 19 | // point: the type comes from the name and the bytes are the browser's problem. | |
| 20 | const png = "\x89PNG\r\n\x1a\npayload" | ||
| 20 | // The NUL is the part that matters to git: without one it calls these bytes text, | ||
| 21 | // prints a ---/+++ pair, and never exercises the case a real PNG hits, where the | ||
| 22 | // diff names the file only in its `diff --git` header. | ||
| 23 | const png = "\x89PNG\r\n\x1a\n\x00payload" | ||
| 21 | 24 | ||
| 22 | 25 | func getWithHeaders(t *testing.T, url string) (*http.Response, string) { | |
| 23 | 26 | t.Helper() | |