SoarinFerret / dokuwiki-plugin-pagebuttons

https://www.dokuwiki.org/plugin:pagebuttons
GNU General Public License v2.0
0 stars 8 forks source link

After upgrade to Kaos 6a underscores are not added during page create #20

Open macin opened 4 months ago

macin commented 4 months ago

See thread on main dokuwiki GitHub. I am using page buttons to create pages inside my instance of dokuwiki.

https://github.com/dokuwiki/dokuwiki/issues/4238

fiwswe commented 4 months ago

Disclaimer: I have never used this plugin myself.

https://github.com/SoarinFerret/dokuwiki-plugin-pagebuttons/blob/b8e3cec0da303167d48394b5238b8011207f69c1/script.js#L141-L142

and https://github.com/SoarinFerret/dokuwiki-plugin-pagebuttons/blob/b8e3cec0da303167d48394b5238b8011207f69c1/script.js#L163-L164

show that an URL is constructed that contains the literal string of the page name that the user entered, including spaces or other special characters and then the browser is instructed to redirect to that URL. Since spaces are illegal in URLs they are converted to %20 by the browser.

This does not seem to have changed and there seems no relation to the DokuWiki "Kaos" release. This was always broken.

In order to respect DokuWiki's sepchar setting, and potentially other code in DokuWiki used to convert user input to page IDs, there would need to be major changes made to this plugin.

macin commented 1 month ago

I tried a different approach. I disabled "nice urls" and the page creation works well, including entering title with spaces. It doesn't work when I enabled .htaccess rewrite rule

What's more, it is not possible to create a page at all then on windows (my local test version). On ubuntu (my prod) there is only a problem with spaces after enabling nice url based on .htaccess rewrite

I am using just a standard .htaccess file provided by dokuwiki installation

## You should disable Indexes and MultiViews either here or in the
## global config. Symlinks maybe needed for URL rewriting.
#Options -Indexes -MultiViews +FollowSymLinks

## make sure nobody gets the htaccess, README, COPYING or VERSION files
<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</Files>

## Don't allow access to git directories
<IfModule alias_module>
    RedirectMatch 404 /\.git
</IfModule>

## Uncomment these rules if you want to have nice URLs using
## $conf['userewrite'] = 1 - not needed for rewrite mode 2
RewriteEngine on

RewriteRule ^_media/(.*)              lib/exe/fetch.php?media=$1  [QSA,L]
RewriteRule ^_detail/(.*)             lib/exe/detail.php?media=$1  [QSA,L]
RewriteRule ^_export/([^/]+)/(.*)     doku.php?do=export_$1&id=$2  [QSA,L]
RewriteRule ^$                        doku.php  [L]
RewriteCond %{REQUEST_FILENAME}       !-f
RewriteCond %{REQUEST_FILENAME}       !-d
RewriteRule (.*)                      doku.php?id=$1  [QSA,L]
RewriteRule ^index.php$               doku.php

#
## Not all installations will require the following line.  If you do,
## change "/dokuwiki" to the path to your dokuwiki directory relative
## to your document root.
#RewriteBase /dokuwiki
#
## If you enable DokuWikis XML-RPC interface, you should consider to
## restrict access to it over HTTPS only! Uncomment the following two
## rules if your server setup allows HTTPS.
#RewriteCond %{HTTPS} !=on
#RewriteRule ^lib/exe/xmlrpc.php$      https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]

This is causing a lot of problems to my users because they cannot create pages easily...always forget to enter namespace name without space... So any ideas on how to fix it would be highly appreciated.

fiwswe commented 1 month ago

I believe I explained what I think probably happens in https://github.com/dokuwiki/dokuwiki/issues/4238#issuecomment-1986960140. However I admit that I am not 100% sure about the value of pre_url in the JavaScript part. Maybe you could look at your Apache httpd logs and check which URLs are actually requested? That might shed some light on what is going on.

FWIW: I use neither the Page Buttons Plugin nor the Apache httpd URL rewriting method for nice URLs in any of my wikis. (That would create a dependency on Apache httpd that I don't want.) And setting up a testing environment for something I don't use is not very high on my list of priorities, sorry.

I have not seen any indication that the Kaos release has changed anything relevant. But I did not do an intensive search for any such changes either. But the plugin page indicates that compatibility with Jack Jackrum was unknown as well as Kaos. So if something changed, maybe it was between Igor and Jack Jackrum?

Other options for avoiding the issue: You might try different plugins, or getting your users to do the normal Wiki thing and just type the new page title into the content of an existing page and make it a link by enclosing it in [[…]], or don't use the rewrite method, ….

HTH and good luck! fiwswe