facade / ignition-code-editor

Add inline code editing to your ignition page
http://flareapp.io/docs/ignition-for-laravel/first-party-extensions#ignition-code-editor
MIT License
44 stars 5 forks source link

SaveFileContentController wrong filepath under windows #9

Open axelzuzek opened 5 years ago

axelzuzek commented 5 years ago

Saving a change results in a

 "message": "Requested file does not exist.",
 "exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",

in Facade\CodeEditor\Http\Controllers\SaveFileContentController:

        $file = $request->get('file');
        abort_unless($file, Response::HTTP_UNPROCESSABLE_ENTITY);
        $filePath = base_path($file);
        $this->ensureFileExistInProject($filePath);

example under windows echo $file; => C:\dev\myApp\app\Http\Controllers\Frontend\MainController.php

echo $filePath; => C:\dev\myApp\C:\dev\myApp\app\Http\Controllers\Frontend\MainController.php

is this a configuration problem (in my setup) or a bug?

nimbomx commented 5 years ago

I had the same problem, I solved it provisionally by adding in SaveFileContentController.php and FileContentsController.php this line:


abort_unless($file, Response::HTTP_UNPROCESSABLE_ENTITY);
$file = str_replace(base_path(), '', $file); // new line 
$filePath = base_path($file);```
axelzuzek commented 5 years ago

Hm there seems to be another problem: $request->get('value') only contains the first 30 lines of the file, the rest is cut.

tutorialesvirtuales commented 5 years ago

Same problem, ignition-code-editor/file-contents not Found

patrickadvance commented 5 years ago

@nimbomx your solution is magically.

ali28729 commented 5 years ago

@nimbomx +1