# HG changeset patch # User Yuya Nishihara # Date 2018-09-07 13:19:28 # Node ID 1a786fe069b8b4ee28fef0f619e6daf3939e8201 # Parent 6772cf74ff6ffeece7ce50a9affad5b1766581af hgweb: add error template to json so it won't crash diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map --- a/mercurial/templates/json/map +++ b/mercurial/templates/json/map @@ -241,3 +241,6 @@ indexentry = '\{ "lastchange": {lastchange|json}, "labels": {labels|json} }' +error = '\{ + "error": {error|utf8|json} + }' diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -2183,6 +2183,16 @@ help/{topic} shows an individual help to "topic": "phases" } +Error page shouldn't crash + + $ request json-changeset/deadbeef + 404 Not Found + + { + "error": "unknown revision 'deadbeef'" + } + [1] + Commit message with Japanese Kanji 'Noh', which ends with '\x5c' $ echo foo >> da/foo