Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

SaveFileContentController wrong filepath under windows #9

Open
axelzuzek opened this issue Sep 11, 2019 · 5 comments
Open

SaveFileContentController wrong filepath under windows #9

axelzuzek opened this issue Sep 11, 2019 · 5 comments

Comments

@axelzuzek
Copy link

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
Copy link

nimbomx commented Sep 11, 2019

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
Copy link
Author

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

@tutorialesvirtuales
Copy link

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

@patrickadvance
Copy link

@nimbomx your solution is magically.

@ali28729
Copy link

@nimbomx +1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants