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

Add gotenberg output filename #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

StevenRenaux
Copy link
Collaborator

@StevenRenaux StevenRenaux commented Jan 8, 2025

Close #91

@StevenRenaux StevenRenaux requested review from Neirda24 and Jean-Beru and removed request for Neirda24 January 8, 2025 14:58
src/Builder/AsyncBuilderTrait.php Outdated Show resolved Hide resolved
@@ -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));
Copy link
Contributor

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.

Copy link
Collaborator Author

@StevenRenaux StevenRenaux Jan 8, 2025

Choose a reason for hiding this comment

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

Copy link
Contributor

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 ?

Copy link
Contributor

@Jean-Beru Jean-Beru Jan 8, 2025

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.

Copy link
Contributor

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.

@StevenRenaux StevenRenaux force-pushed the features/Add-Gotenberg-Output-Filename-if-fileName-is-set branch from 0b321da to f247756 Compare January 8, 2025 16:36
@StevenRenaux StevenRenaux force-pushed the features/Add-Gotenberg-Output-Filename-if-fileName-is-set branch from f247756 to 3944a70 Compare January 10, 2025 15:47
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.

Send Gotenberg-Output-Filename if fileName is set
3 participants