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

ENH Do not show icon if binary is not available #30

Merged

Conversation

emteknetnz
Copy link
Member

Issue https://github.com/silverstripeltd/product-issues/issues/613

Code is copied from https://github.com/silverstripe/cwp-pdfexport/blob/1.4/src/Extensions/PdfExportControllerExtension.php#L98

I didn't use a static helper function due to the use of $this->owner->config()->get('wkhtmltopdf_binary');

I think code duplication is fine in this context

@emteknetnz emteknetnz force-pushed the pulls/1/graceful-fail branch from 215207b to d7b534a Compare November 29, 2022 01:33
Copy link

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be mostly doing what it's advertised to do.

One of the ACs stated "and any endpoint for generating PDF returns a suitable error."

If I directly try to navigate to http://sink4x.max.silverstripe.com/home/downloadpdf, I get a 500, because it will still try to generate the PDF. My preference is would be that we explicitly check for the presence of the binary and return a 400 or 404 at that stage.

@emteknetnz emteknetnz force-pushed the pulls/1/graceful-fail branch from d7b534a to 37a22f9 Compare December 5, 2022 03:57
@emteknetnz emteknetnz force-pushed the pulls/1/graceful-fail branch from 37a22f9 to 1beefbb Compare December 5, 2022 03:59
@emteknetnz
Copy link
Member Author

Have updated, now returns a 400 if the binary is missing when you visit the endpoint

@maxime-rainville maxime-rainville merged commit 7f9a0b4 into silverstripe:1 Dec 6, 2022
@maxime-rainville maxime-rainville deleted the pulls/1/graceful-fail branch December 6, 2022 01:02
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