Pico-Editor-Plugin
Pico-Editor-Plugin copied to clipboard
Unable to see content in subfolders?
It seems that Pico Editor doesn’t get content pages that are in ‘categories’ i.e. in a subfolder of /content
.
For instance /content/projects/project1.md
is not displayed in the editor. There’s an ‘Untitled’ line which may be this, but the content is said to be ‘unvalid’.
There is couple of bugs related to handling of subfolders, see the pull request, so patch it first as it may be connected.
Bump on this issue. Any plans to fix the 'Error: invalid file' issue for files in subfolders of 'content' folder?
Fix for bug: https://github.com/gilbitron/Pico-Editor-Plugin/pull/20
Change line 292 of PicoEditor.php
$file = basename(strip_tags($file_url));
into
$file = substr(strip_tags($file_url), 1);
basename()
was removing the sub-folder, aditionaly, the urls where being requested with double slash (example.com//page), that might have security implications according to this stackoverflow answer.
Edit: I've discovered there's another bug related with sub-folders. If you delete "/?sub/page", "/?page" will be deleted instead! Also, when editing "/?sub/page", "/?page" will be overriden.
This is again caused by the basename
function wich will output page
given "/testweb/page.php"
or "/page.php"
(it removes the sub-folder part of the query)
Replace line 320 and 394 with $file = substr(strip_tags($file_url), 1);
Note: I've just realized I've posted this in the wrong repo xD my version of PicoEditor is the one from this repo wich is also the one linked in (picocms.org/plugins.html)[http://picocms.org/plugins.html]. Sorry for this, it may not work at all. :sob: