Skip to content

Ensure generated label PDFs have correct extension - #12870

Merged
SchrodingersGat merged 2 commits into
inventree:masterfrom
ledvinap:fix/label-pdf-extension
Sep 18, 2026
Merged

SchrodingersGat merged 2 commits into
inventree:masterfrom
ledvinap:fix/label-pdf-extension

Conversation

@ledvinap

Copy link
Copy Markdown
Contributor

Label templates may intentionally use extensionless filename patterns — for example, templates shared with physical-printer plugins.
When the built-in PDF plugin generates a downloadable file, append .pdf if missing without changing the template pattern.
Preserve existing .pdf/.PDF suffixes and use labels.pdf when the filename is empty, None, or omitted. HTML debug output remains unchanged.

Adds regression coverage for suffixless, existing-suffix, empty, None, and omitted filenames.

@netlify

netlify Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit 912d9aa
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6aabee20feb4820008bc8275

@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.26%. Comparing base (3a0ade3) to head (912d9aa).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #12870   +/-   ##
=======================================
  Coverage   87.26%   87.26%           
=======================================
  Files        1502     1502           
  Lines      102169   102184   +15     
  Branches    11661    11661           
=======================================
+ Hits        89156    89171   +15     
  Misses      12948    12948           
  Partials       65       65           
Flag Coverage Δ
backend 91.87% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 92.54% <100.00%> (+<0.01%) ⬆️
Backend General 94.72% <ø> (ø)
Frontend 79.82% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat

Copy link
Copy Markdown
Member

Does this fix need to be applied to reports also?

@ledvinap

Copy link
Copy Markdown
Contributor Author

Does this fix need to be applied to reports also?

It is already handed for reports, but it can be slightly improved (no .PDF.pdf, report.pdf instead of .pdf for empty report_)name) (https://github.com/inventree/InvenTree/blob/master/src/backend/InvenTree/report/models.py#L662)

@SchrodingersGat
SchrodingersGat merged commit 98f4a82 into inventree:master Sep 18, 2026
48 checks passed
@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed report Report/Label generation backport Apply this label to a PR to enable auto-backport action backport-to-1.5.x labels Sep 18, 2026
@SchrodingersGat SchrodingersGat added this to the 1.6.0 milestone Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
✅ 1.5.x

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

SchrodingersGat added a commit that referenced this pull request Sep 19, 2026
* Ensure generated label PDFs retain their extension

* Test generated label PDF filename handling

(cherry picked from commit 98f4a82)

Co-authored-by: Petr Ledvina <[email protected]>
Co-authored-by: Oliver <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Apply this label to a PR to enable auto-backport action backport-to-1.5.x bug Identifies a bug which needs to be addressed report Report/Label generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants