Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thanks for contributing to WordPress Playground! --> ## What? This pr adds a 404 error if the requested path doesn't exist <!-- In a few words, what is the PR actually doing? Include screenshots or screencasts if applicable --> We decided to split #331 into two parts, to make changes clear. Part 2 of #331 Part 1 is #387 ## Why? When the user uses a path that doesn't have any files, the `wp-now` was throwing an error, and was no longer usable. This pr fixes that. Also, take a look at #331 <!-- Why is this PR necessary? What problem is it solving? Reference any existing previous issue(s) or PR(s), but please add a short summary here, too --> ## How? When we call `php.run` method, we build the `scriptPath` using `resolvePHPFilePath`. If the file is not there we assume that an `/index.php` file exists in the folder. This is not correct, and we need to return a 404 `PhpRequest`. Also, take a look at #331 <!-- How is your PR addressing the issue at hand? What are the implementation details? --> ## Testing Instructions - Create an empty folder - Run wp-now and make sure you add this folder as a path: npx nx preview wp-now start --path=<your-empty-folder> - Ensure that you don't see any errors in the console - Ensure that you see 404 File not found in the browser - Change the URL to something else. eg: /file-not-exist.php. - Ensure that you still see 404 File not found
- Loading branch information