gilbitron / Pico-Editor-Plugin

Provides an online Markdown editor and file manager for Pico.
http://pico.dev7studios.com
MIT License
58 stars 30 forks source link

Unable to see content in subfolders? #17

Open nclm opened 9 years ago

nclm commented 9 years ago

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

w-vi commented 9 years ago

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

glasswork commented 9 years ago

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

nyanpasu64 commented 8 years ago

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

AeonFr commented 8 years ago

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: