i-net-software / dokuwiki-plugin-multiorphan

Administrative GUI to find all sorts of orphaned or wanted pages and media. This works using AJAX instead of loading everything into one page.
https://www.dokuwiki.org/plugin:multiorphan
5 stars 5 forks source link

Delete Media does not work #27

Closed Tuxdiver closed 5 years ago

Tuxdiver commented 6 years ago

I have a problem with delete of orphaned medias: when I click on "verwaist" (orphaned) and then "delete" for a media file, the row becomes orange, but the media file is not deleted.

Clicking on "view" shows the file. Media manager can delete the files, if selected manually.

Browser: Chrome, Firefox Wiki: Release 2017-02-19e "Frusterick Manners" Plugin: latest version, installed with plugin manager

Best regards, Dirk

JensForstmann commented 6 years ago

I've the same issue and tracked it down to a doubled url encoding of the file which should be deleted.

In my case the Ajax POST request sends the following (not working):

do=deleteMedia&link=lalai%253Asimbababi%253A1f99cee704324e63d15dd850428ed4e8.png&ns=%3Alalai&filter=&sectok=1a1ef11b1842fce9a550e4f7e148a0d3&call=multiorphan

If I change the POST to the follwing, it works:

do=deleteMedia&link=lalai%3Asimbababi%3A1f99cee704324e63d15dd850428ed4e8.png&ns=%3Alalai&filter=&sectok=1a1ef11b1842fce9a550e4f7e148a0d3&call=multiorphan

The chance is the namespace sperator %3A instead of a doubled encoded colon %253A in the "link"-field. The "ns"-field is correctly encoded with only %3A

JensForstmann commented 6 years ago

I hotfixed it for myself by changing line 44 in the script.js (/var/www/dokuwiki/lib/plugins/multiorphan/script.js in my case):

before change: request({'do':'delete'+type , 'link':$link.attr('elementid')}, function(response){

after change: request({'do':'delete'+type , 'link':decodeURIComponent($link.attr('elementid'))}, function(response){