-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add gotenberg output filename #137
base: main
Are you sure you want to change the base?
Add gotenberg output filename #137
Conversation
@@ -69,6 +70,10 @@ protected function encodeData(string $key, mixed $value): array | |||
*/ | |||
public function fileName(string $fileName, string $headerDisposition = HeaderUtils::DISPOSITION_INLINE): static | |||
{ | |||
if (!preg_match('/\.[^.]+$/', $fileName)) { | |||
throw new InvalidBuilderConfiguration(\sprintf('File name "%s" needs to get extension as ".pdf", ".png" or any other valid extension.', $fileName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually no. Because whatever we do Gotenberg will add the extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah but needed with extension I think for the processor :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally we guess the filename from the response. Maybe there are some edge cases @Jean-Beru ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can extract the filename from the response to pass it to the processor constructor. But it means that the request will be sent before calling GotenbergFileResult::process
or GotenbergFileResult::stream
to retrieve headers.
An other solution could be that a processor doesn't receive the filename in its constructor. It will have to retrieve it by itself from a chunk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to dig a bit to understand more.
0b321da
to
f247756
Compare
f247756
to
3944a70
Compare
Close #91