Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Side effect from Andreas de Pretis' patch #3

Open
einhirn opened this issue Dec 15, 2023 · 2 comments
Open

Side effect from Andreas de Pretis' patch #3

einhirn opened this issue Dec 15, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@einhirn
Copy link
Contributor

einhirn commented Dec 15, 2023

This Patch 6bd8af2 has has some side effects. They will only appear on rare conditions, but never the less: if you deleted the Page ID “wiki:test” and now have a page “wiki:test:start”, you won't be able to revisit “wiki:test” to look for old Versions etc.

A possible workaround would be to look into what happens under the conditions Andreas described originally to figure out what actions we need to redirect on in addition to show. Or we could just add a Flag to the URL &redirect=no like https://www.dokuwiki.org/plugin:redirect does:

https://github.com/splitbrain/dokuwiki-plugin-redirect/blob/661b3e4ef4b6be1b9063a3411bcc3c3e9061768b/action.php#L43
https://github.com/splitbrain/dokuwiki-plugin-redirect/blob/661b3e4ef4b6be1b9063a3411bcc3c3e9061768b/action.php#L46

This is in the event hook for "DOKUWIKI_STARTED", but since it's global $INPUT , this should work for us, too.

@zaher zaher added the bug Something isn't working label Dec 15, 2023
@zaher zaher pinned this issue Dec 15, 2023
@zaher
Copy link
Member

zaher commented Dec 15, 2023

Ty, I am not in PHP mood this days, but if you can fix it, PR is welcome, or you can wait to switch to php projects.

@einhirn
Copy link
Contributor Author

einhirn commented Mar 15, 2024

Just for completeness sake, here's what Andreas de Pretis wrote in the old discussion section of the plugin page:

Very handy plugin, great work! By the way: redirecting into a namespace (e.g. foobar -> foobar:start) only works if the user/group has at least read permissions for the underlying/root namespace. In certain setups, e.g. one namespace per customer, this can be very tedious to securely implement. By removing a condition for the HTTP redirect this works out and permissions are checked on the target page anyway.

This was his original patch:

--- lib/plugins/autostart/action.php.orig       2009-11-24 20:41:31.000000000 +0100
+++ lib/plugins/autostart/action.php    2009-11-24 20:42:58.000000000 +0100
@@ -36,7 +36,7 @@
     function preprocess(& $event, $param) {
         global $conf;
         global $ID;
-        if (!$this->page_exists($ID) && $event->data == 'show')
+        if (!$this->page_exists($ID))
         {
             if($this->page_exists($ID.':'.$conf['start']))
                 // start page inside namespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants