Skip to content

fix: respect custom filename during PDF generation - #846

Open
Jannik-cmyk wants to merge 1 commit into
asyncapi:masterfrom
Jannik-cmyk:agent/fix-custom-pdf-filename
Open

fix: respect custom filename during PDF generation#846
Jannik-cmyk wants to merge 1 commit into
asyncapi:masterfrom
Jannik-cmyk:agent/fix-custom-pdf-filename

Conversation

@Jannik-cmyk

Copy link
Copy Markdown

Summary

  • use outFilename as the source HTML file during PDF generation
  • derive the PDF filename from the configured HTML filename
  • construct cross-platform-safe file URLs
  • always close Puppeteer after success or failure
  • add focused regression tests for default, custom and failing paths

Root cause

The HTML template writes the generated documentation to
params.outFilename || 'index.html', but the PDF hook always read
index.html and wrote index.pdf. PDF generation therefore failed or
generated the wrong output whenever outFilename was customized.

Validation

  • node --check hooks/99_generatePdf.js
  • node --check test/hooks/99_generatePdf.test.js
  • direct mocked Node harness covering filename derivation, URL encoding,
    browser cleanup and failure paths
  • git diff --check
  • npm run lint

The repository Jest and generator suites could not be executed locally because
the required dependencies and CLI were unavailable in the execution
environment. They will be validated by the repository CI.

Fixes #826

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@sonarqubecloud

Copy link
Copy Markdown

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.

[BUG] param pdf does not work with outFilename

1 participant