[PATCH 2 of 4] hgweb: add error template to json so it won't crash
Yuya Nishihara
yuya at tcha.org
Fri Sep 7 13:39:45 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1536326368 -32400
# Fri Sep 07 22:19:28 2018 +0900
# Node ID 90fe6481af4fd42def159f8e501612f305979822
# Parent cd0c58017ae949408c1e746c9c81ca6847591b3c
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
More information about the Mercurial-devel
mailing list