Skip to content

Fix 404 for model names containing slashes#13

Merged
Izzetee merged 1 commit intomainfrom
fix/model-name-slash-encoding
Mar 30, 2026
Merged

Fix 404 for model names containing slashes#13
Izzetee merged 1 commit intomainfrom
fix/model-name-slash-encoding

Conversation

@Izzetee
Copy link
Copy Markdown
Owner

@Izzetee Izzetee commented Mar 30, 2026

Summary

  • Model names like google/gemma-3-4b (common with LM Studio / HuggingFace naming) caused 404 errors on the enable/disable toggle and benchmark endpoints
  • The frontend correctly encodes the slash as %2F, but gorilla/mux decoded it back to / before matching, breaking the route

Fix

  • Enable UseEncodedPath() on the mux router so %2F stays encoded during route matching
  • Add url.PathUnescape() in handleSetModelEnabled and handleGetModelBenchmarks to decode the name for DB lookups

Test plan

  • go test -short ./... passes
  • Toggle enable/disable on a model with / in the name (e.g. google/gemma-3-4b from LM Studio)
  • View benchmark results for a model with / in the name
  • Models without slashes still work as before

Enable UseEncodedPath() on the mux router so percent-encoded slashes
(%2F) in model names are not interpreted as path separators. Add
url.PathUnescape() in both handlers that read {name} from the path.

Affects: PATCH /models/{name}/enable, GET /models/{name}/benchmarks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Izzetee Izzetee merged commit 373dbe5 into main Mar 30, 2026
6 checks passed
@Izzetee Izzetee deleted the fix/model-name-slash-encoding branch March 30, 2026 21:15
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

Successfully merging this pull request may close these issues.

1 participant