Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for directory existence when storing console log or storing source, if it does not exist create it #1143

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

ssanko
Copy link
Contributor

@ssanko ssanko commented Oct 11, 2024

This PR fixes missing destination directory for storing console log or source code.

Currently when saving console log or source code to the path defined in \Laravel\Dusk\Browser::$storeConsoleLogAt or \Laravel\Dusk\Browser::$storeSourceAt, the code does not check for the existence of the directory.

Because of missing check for destination directory existence, current code throws ErrorException when trying to save console log or source code:

file_put_contents(/Sites/laravel-dusk/storage/app/customPath/pageSources/source.txt): Failed to open stream: No such file or directory

This PR adds code to check for the exitence of the destination directory and if it does not exist, then tries to create it.

@taylorotwell
Copy link
Member

Any reason why you use 0777 permissions instead of 0755?

@ssanko
Copy link
Contributor Author

ssanko commented Oct 14, 2024

I wanted to stick to the logic used in method \Laravel\Dusk\Browser::screenshotElement which uses the 0777 permission.

So if the 0755 is more reasonable, then I'll change the permissions also for \Laravel\Dusk\Browser::screenshotElement method.

@taylorotwell taylorotwell merged commit a5f70c8 into laravel:8.x Oct 14, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants