diff --git a/CHANGELOG.md b/CHANGELOG.md index 164db45..b33bc83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Ability to set custom keybindings in config (#135) - Added scrollbar, by default only appears on pages that go off-screen (#89, #107) - More internal about pages, see `about:about` (#160, 187) -- Sensitive input fields (status code 11) display with asterisks over the text (#106) ### Changed - Update cview to `d776e728ef6d2a9990a5cd86a70b31f0678613e2` for large performance and feature updates (#107) - Update to tcell v2 (dependency of cview) +- Display page even if mediatype params are malformed (#141) +- Sensitive input fields (status code 11) display with asterisks over the text (#106) ### Fixed - Don't use cache when URL is typed in bottom bar (#159) diff --git a/renderer/page.go b/renderer/page.go index 0e373e4..940a322 100644 --- a/renderer/page.go +++ b/renderer/page.go @@ -32,15 +32,21 @@ func isUTF8(charset string) bool { return false } -// getMetaInfo returns the output of mime.ParseMediaType, but handles the empty +// decodeMeta returns the output of mime.ParseMediaType, but handles the empty // META which is equal to "text/gemini; charset=utf-8" according to the spec. func decodeMeta(meta string) (string, map[string]string, error) { if meta == "" { - params := make(map[string]string) - params["charset"] = "utf-8" - return "text/gemini", params, nil + return "text/gemini", make(map[string]string), nil } - return mime.ParseMediaType(meta) + + mediatype, params, err := mime.ParseMediaType(meta) + + if mediatype != "" && err != nil { + // The mediatype was successfully decoded but there's some error with the params + // Ignore the params + return mediatype, make(map[string]string), nil + } + return mediatype, params, err } // CanDisplay returns true if the response is supported by Amfora