ignition-code-editor icon indicating copy to clipboard operation
ignition-code-editor copied to clipboard

SaveFileContentController wrong filepath under windows

Open axelzuzek opened this issue 5 years ago • 5 comments

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?

axelzuzek avatar Sep 11 '19 13:09 axelzuzek

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);```

nimbomx avatar Sep 11 '19 14:09 nimbomx

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

axelzuzek avatar Sep 11 '19 17:09 axelzuzek

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

tutorialesvirtuales avatar Sep 12 '19 05:09 tutorialesvirtuales

@nimbomx your solution is magically.

patrickadvance avatar Sep 12 '19 11:09 patrickadvance

@nimbomx +1

ali28729 avatar Sep 25 '19 19:09 ali28729