summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritchyny <itchyny@cybozu.co.jp>2023-07-13 23:23:23 +0900
committerGitHub <noreply@github.com>2023-07-13 23:23:23 +0900
commit689a4e660b34bc687e6df05a79308d00e9c4f9cb (patch)
tree11370caa946a115bba48c1592fcd13321182e1d1
parent55249e29beb6847ef13d5c38899a7cf0ebdc018e (diff)
Fix uri format to follow RFC 3986 (#2157)
-rw-r--r--src/builtin.c2
-rw-r--r--tests/jq.test22
2 files changed, 12 insertions, 12 deletions
diff --git a/src/builtin.c b/src/builtin.c
index 3cde6866..d92b5482 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -645,7 +645,7 @@ static jv f_format(jq_state *jq, jv input, jv fmt) {
input = f_tostring(jq, input);
int unreserved[128] = {0};
- const char* p = CHARS_ALPHANUM "-_.!~*'()";
+ const char* p = CHARS_ALPHANUM "-_.~";
while (*p) unreserved[(int)*p++] = 1;
jv line = jv_string("");
diff --git a/tests/jq.test b/tests/jq.test
index 39620433..3182c1f3 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -61,17 +61,17 @@ null
null
"interpolation"
-@text,@json,([1,.] | (@csv, @tsv)),@html,@uri,@sh,@base64,(@base64 | @base64d)
-"<>&'\"\t"
-"<>&'\"\t"
-"\"<>&'\\\"\\t\""
-"1,\"<>&'\"\"\t\""
-"1\t<>&'\"\\t"
-"&lt;&gt;&amp;&apos;&quot;\t"
-"%3C%3E%26'%22%09"
-"'<>&'\\''\"\t'"
-"PD4mJyIJ"
-"<>&'\"\t"
+@text,@json,([1,.]|@csv,@tsv),@html,@uri,@sh,(@base64|.,@base64d)
+"!()<>&'\"\t"
+"!()<>&'\"\t"
+"\"!()<>&'\\\"\\t\""
+"1,\"!()<>&'\"\"\t\""
+"1\t!()<>&'\"\\t"
+"!()&lt;&gt;&amp;&apos;&quot;\t"
+"%21%28%29%3C%3E%26%27%22%09"
+"'!()<>&'\\''\"\t'"
+"ISgpPD4mJyIJ"
+"!()<>&'\"\t"
# regression test for #436
@base64