diff --git a/handler/handler.go b/handler/handler.go index f4d5d15..24f7cbf 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -115,13 +115,13 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } // set query from route path := strings.TrimPrefix(r.URL.Path, "/") - var rest string - q.User, rest = splitHalf(path, "/") // move to path with ! - if strings.HasSuffix(rest, "!") { + if strings.HasSuffix(path, "!") { q.MoveToPath = true - rest = strings.TrimSuffix(rest, "!") + path = strings.TrimRight(path, "!") } + var rest string + q.User, rest = splitHalf(path, "/") q.Program, q.Release = splitHalf(rest, "@") // no program? treat first part as program, use default user if q.Program == "" { diff --git a/handler/handler_test.go b/handler/handler_test.go index f459396..ec58361 100644 --- a/handler/handler_test.go +++ b/handler/handler_test.go @@ -31,6 +31,17 @@ func TestMicro(t *testing.T) { } } +func TestMicroDoubleBang(t *testing.T) { + h := &handler.Handler{} + r := httptest.NewRequest("GET", "/micro!!", nil) + w := httptest.NewRecorder() + h.ServeHTTP(w, r) + t.Log(w.Body.String()) + if w.Result().StatusCode != 200 { + t.Fatalf("failed to get micro!! asset status") + } +} + func TestGotty(t *testing.T) { h := &handler.Handler{} r := httptest.NewRequest("GET", "/yudai/gotty@v0.0.12", nil)