Pico-Editor-Plugin icon indicating copy to clipboard operation
Pico-Editor-Plugin copied to clipboard

Unable to see content in subfolders?

Open nclm opened this issue 10 years ago • 4 comments

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’.

nclm avatar Nov 18 '14 11:11 nclm

There is couple of bugs related to handling of subfolders, see the pull request, so patch it first as it may be connected.

w-vi avatar Nov 18 '14 12:11 w-vi

Bump on this issue. Any plans to fix the 'Error: invalid file' issue for files in subfolders of 'content' folder?

glasswork avatar Aug 17 '15 18:08 glasswork

Fix for bug: https://github.com/gilbitron/Pico-Editor-Plugin/pull/20

nyanpasu64 avatar Oct 14 '15 03:10 nyanpasu64

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:

AeonFr avatar Nov 25 '15 19:11 AeonFr