]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/bugs/About___37__2F_problem.mdwn
I'm confused about what the bug is, and what's being fixed. Can you give a complete...
[git.ikiwiki.info.git] / doc / bugs / About___37__2F_problem.mdwn
1 I use inline to create a blog like the below:
3     \[[!inline pages="./bugs/* and !./bugs/done and !./bugs/discussion and 
4     !link(patch) and !link(./bugs/done) and !./bugs/*/*"
5     actions=yes rootpage="./bugs" postform="yes" postformtext="请用一句话简述问题,然后点击 Edit 按钮添加具体细节" show=0]]
8 When I use posform to add a new page, it show:
10 > Error: bad page name 
12 Its url include a %2F, like below:
14 > http://172.16.0.109/ikiwiki.cgi?do=blog&from=.%2Fbugs&subpage=1&title=aaa
16 I use ikiwiki 3.20180311
18 ----
20 I have found that it is not "%2F"'s problem, it just that inline directive can
21 not deal with Chinese char, the below link can work
23     http://172.16.0.109/ikiwiki.cgi?do=blog&from=aaa%2Fbugs&subpage=1&title=aaa
25 ---
27 > I don't think this is actually caused by the Chinese text. The problem is that
28 > you used `rootpage="./bugs"`, which leads to the `blog` request handler
29 > generating an invalid page name. If you change it to `rootpage="bugs"` does
30 > that fix the error?
31 >
32 > Ideally either the `inline` directive or the `blog` request handler would
33 > understand and remove `./`, if it's something that makes sense in this context.
34 > --[[smcv]]
36 ---
38 > I have found the problem, it is inline plugin can not decode_utf8 "from", the below is patch:
40     From f79dde20b275707f70df2d481919a079abec6c19 Mon Sep 17 00:00:00 2001
41     From: Feng Shu <tumashu@163.com>
42     Date: Sun, 2 Dec 2018 08:38:34 +0800
43     Subject: [PATCH 1/2] Fix inline plugin can no set rootpage to a UTF-8 page
44     
45     ---
46      IkiWiki/Plugin/inline.pm | 2 +-
47      1 file changed, 1 insertion(+), 1 deletion(-)
48     
49     diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
50     index a85cd5d2f..f40956821 100644
51     --- a/IkiWiki/Plugin/inline.pm
52     +++ b/IkiWiki/Plugin/inline.pm
53     @@ -125,7 +125,7 @@ sub sessioncgi ($$) {
54                         error(gettext("please enter a page title"));
55                 }
56                 # if the page already exists, munge it to be unique
57     -           my $from=$q->param('from');
58     +           my $from=decode_utf8($q->param('from'));
59                 my $add="";
60                 while (exists $IkiWiki::pagecase{lc($from."/".$page.$add)}) {
61                         $add=1 unless length $add;
62     -- 
63     2.19.0
64     
65 ---
67 > Please could you try to make a minimal example or test, perhaps in the [[sandbox]]
68 > on this wiki or as a unit test in `t/git-cgi.t` in the ikiwiki source code, that
69 > demonstrates this bug and would be fixed by your patch? I tried to write a test
70 > for this, and I was able to make a test that uses a UTF-8 `rootpage` and fails;
71 > but your patch doesn't seem to fix it, so you must be seeing something different.
72 > I think there might be more than one bug here.
73 >
74 > If you've found multiple bugs, a separate example or test for each one would be
75 > easiest to deal with.
76 >
77 > In your original report, you said the `rootpage` was ASCII and started with `./`:
78 > `./bugs`. Then you mentioned Chinese characters (any non-ASCII character like é or ¬
79 > should behave the same as Chinese here) and attached a patch that alters how those
80 > are handled, without affecting what would happen to a `rootpage` that starts
81 > with `./`; so I'm confused about what the bug was, and what you are fixing?
82 >
83 > I've added tests to `t/git-cgi.t` which demonstrate a blog form for a `rootpage`
84 > named `writable/blog` working correctly (which passes), and a `rootpage` named
85 > `writable/¬blog` not working correctly (which fails, and is marked as *TODO*).
86 > The patch above doesn't seem to make the second new test pass.
87 >
88 > You can run all the tests with:
89 >
90 >     ./Makefile.PL
91 >     make
92 >     make test
93 >
94 > or a single test with something like:
95 >
96 >     ./Makefile.PL
97 >     make
98 >     PERL5LIB=. ./t/git-cgi.t
99 >
100 > --[[smcv]]