diff --git a/gno.land/pkg/gnoweb/url.go b/gno.land/pkg/gnoweb/url.go index 6ad218b9a36..cc37ae36887 100644 --- a/gno.land/pkg/gnoweb/url.go +++ b/gno.land/pkg/gnoweb/url.go @@ -152,11 +152,16 @@ func ParseGnoURL(u *url.URL) (*GnoURL, error) { } var file string - if ext := filepath.Ext(upath); ext != "" { - file = filepath.Base(upath) - upath = strings.TrimSuffix(upath, file) - // Trim last slash + // A file is considered as one that either ends with an extension or + // contains an uppercase rune + ext := filepath.Ext(upath) + base := filepath.Base(upath) + if ext != "" || strings.ToLower(base) != base { + file = base + upath = strings.TrimSuffix(upath, base) + + // Trim last slash if any if i := strings.LastIndexByte(upath, '/'); i > 0 { upath = upath[:i] } diff --git a/gno.land/pkg/gnoweb/url_test.go b/gno.land/pkg/gnoweb/url_test.go index f4729668d71..b4e901d4f10 100644 --- a/gno.land/pkg/gnoweb/url_test.go +++ b/gno.land/pkg/gnoweb/url_test.go @@ -237,6 +237,19 @@ func TestParseGnoURL(t *testing.T) { Domain: "gno.land", }, }, + + { + Name: "no extension file", + Input: "https://gno.land/r/demo/lIcEnSe", + Expected: &GnoURL{ + Path: "/r/demo", + File: "lIcEnSe", + Args: "", + WebQuery: url.Values{}, + Query: url.Values{}, + Domain: "gno.land", + }, + }, } for _, tc := range testCases {