turnermm / ckgedit

CKEditor integrated into Dokuwiki
https://www.dokuwiki.org/plugin:ckgedit
GNU General Public License v2.0
60 stars 49 forks source link

Issues inserting images. Incorrect media path. #687

Open trapexit opened 2 years ago

trapexit commented 2 years ago

I recently updated a lot of things so forgive me if perhaps I'm missing something. I've got a nginxproxy/nginx-proxy container fronting the linuxserver.io's dokuwiki image with the PHP7 changes I mentioned in a previous ticket. After moving to this I thought this was working but a few things updated recently.

When using ckgedit plugin and attempting to insert an image the URL generated is /data/media/RELPATH where RELPATH is the relative media path. For instance: /data/media/wiki/logo.png

But the public url to the image is: /_media/wiki/logo.png or /lib/exe/fetch.php?media=wiki:logo.png when using the DW Filebrowser.

Is the expectation to create a rule to redirect? It looks like this is hard coded into lib/plugins/ckgedit/fckeditor/editor/filemanager/connectors/php/config.php

turnermm commented 2 years ago

I have no personal experience with nginx or nginx proxies. But there is a user contributed item on the ckgedit plugin page about how to handle proxies

trapexit commented 2 years ago

The question isn't about the proxies but about how paths are generated by the ckgedit file browser. The path generated by ckgedit's file browser is not valid in my setup and I'm trying to find out why. http://domain/data/media/ is not where files are stored on DokuWiki typically.

Take this image from the main dokuwiki site. It uses /_media/... https://www.dokuwiki.org/_media/marketing:hackfest.jpg

The result of using ckg file browser image

The result of using dw file browser image

Whereas the path I would expect to see is /_media/wiki:logo.png if relying on rewrites by the webserver.

The code that appears to set this is https://github.com/turnermm/ckgedit/blob/6900a33563e01f3a430460c62479e38b61b97e52/fckeditor/editor/filemanager/connectors/php/config.php#L210 and has been around forever. So in the past either it was modified somewhere or people used rewrite rules but I don't recall setting up rules in a previous setup.

turnermm commented 2 years ago
_media/wiki/logo.png
 /lib/exe/fetch.php?media=wiki:logo.png

These are functionally equivalent.

trapexit commented 2 years ago

Yes. But as I showed above the file browser is returning /data/media/wiki/logo.png... not /_media/wiki/logo.png

turnermm commented 2 years ago

http://domain/data/media/ is not where files are stored on DokuWiki typically. Not true.

In any event the ckgedit filebrowser does get the correct url for its use in the image dialog's location bar:

Here, for instance is an example from a test wiki:

imgurl

The problem as I initially suggested is probably in the proxy set up.