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

"Invalid file " shown when opening file #7

Open firzen opened 10 years ago

firzen commented 10 years ago

content folder structure: ├── 404.md ├── index.html ├── index.md ├── Pico-master.md └── sub ├── index.md └── page.md

Then open the /admin url Pages shown correct in the left When I clicked on any page on the left . the right area shown "Error: Invalid file"

I position the error on pico_editor.php line 119. the file url is not corrent . when I want to edit the index.md, the $file variable = Pico-master when I want to edit the sub/index.md, the $file variable = sub when I want to edit the sub/page.md, the $file variable = page

so I suppose this is a very big bug

shoostar commented 10 years ago

Although this isn't a fix, here's what I've learned whilst digging around in Pico's files for a few minutes at the office today: You're best off just deleting all of the default pages in your content directory. Optionally, you can leave 404.md in there, as it really doesn't affect the rest of what I'm about to explain.

If you want something else in there to be the home page (rather than just index.md), you can head to lib/pico.php and edit this line: else $file = CONTENT_DIR .'index'; to something like: else $file = CONTENT_DIR .'Home'; or whatever you want your home page to be titled. Just make sure that you actually create that page in the Pico editor as well, with the same name/capitalization.

Hope this helps a little bit! By the way, I'm not sure how this affects pages in sub-directories, as I haven't played around with it yet.

flashpixx commented 10 years ago

I have got the same error, but only on select the "index.md" page, I can fix this with changing the line 115 in pico_editor.php and replace the if(!$file) die('Error: Invalid file'); to if(!$file) $file = 'index';

w-vi commented 10 years ago

I'm afraid that @gilbitron is not really maintaining it as there are no updates in last months and couple of important fixes were submitted. So I suggest doing what I did, taht is fork and merge/fix all the stuff submitted here.

crempp commented 10 years ago

@w-vi Thanks,

I would like to suggest people use yours, I reviewed the forks and yours seems to fix most of the issues. I grabbed your code and things are working pretty well now.

zQueal commented 9 years ago

@w-vi Just tested your branch, and it works great, man! Thanks.

dotku commented 9 years ago

Wait for updating...