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

Twig extension getCurrentFilePath throw exception (solved, need confirmation) #179

Open
Loocos opened this issue Mar 29, 2022 · 0 comments
Assignees

Comments

@Loocos
Copy link

Loocos commented Mar 29, 2022

Hello there,

I want to know if my solution is the best regarding to your plugin. I've added a second image file type in the ImageType form.
But after that, it throw an error 500 on the form validation if one of the two input image file type is empty/not set.

It come from the RichEditorExtension.php, twig filter function getCurrentFilePath because it's needed to return a string or a null but it's returning an object (UploadedFile)

So my solution is to add a is_object check and return null if true because the file/image isn't uploaded yet and we canno't get the right path :
image

Is it a good solution for you @jacquesbh ?
I can make a PR if that's good for you :)

Thanks

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

No branches or pull requests

2 participants