Skip to content

[1.4.x] Read report/label templates in binary mode (#12432) - #12441

Merged
SchrodingersGat merged 1 commit into
1.4.xfrom
backport/1.4.x/pr-12432
Jul 23, 2026
Merged

[1.4.x] Read report/label templates in binary mode (#12432)#12441
SchrodingersGat merged 1 commit into
1.4.xfrom
backport/1.4.x/pr-12432

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from master to 1.4.x:

Questions ?

Please refer to the Backport tool documentation

* Read report/label templates in binary mode

file_from_template read the template in text mode and wrapped the string
in a ContentFile. The ContentFile size then reflected the character count,
which differs from the UTF-8 byte length for any template that contains
multi-byte characters. Strict S3 implementations such as Backblaze B2
validate the Content-Length header and reject the upload with an
IncompleteBody error. AWS S3 tolerates the mismatch, so the problem is
not visible there.

inventree_transfer_order_report.html is 1458 characters but 1460 bytes.
Its upload fails during create_default_reports, the transaction rolls
back, and the default template is recreated and fails again on every
startup.

Use Path.read_bytes() so the ContentFile size matches the uploaded bytes
and the file handle is closed. Add a regression test asserting the size
equals the file's byte length.

* Test file_from_template across text encodings

(cherry picked from commit ce47cda)
@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed report Report/Label generation labels Jul 21, 2026
@SchrodingersGat SchrodingersGat added this to the 1.4.3 milestone Jul 21, 2026
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.72%. Comparing base (d7283a5) to head (d74c2fd).
⚠️ Report is 2 commits behind head on 1.4.x.

Additional details and impacted files
@@            Coverage Diff             @@
##            1.4.x   #12441      +/-   ##
==========================================
+ Coverage   86.70%   86.72%   +0.01%     
==========================================
  Files        1389     1389              
  Lines       90477    90621     +144     
  Branches    10222    10222              
==========================================
+ Hits        78452    78590     +138     
- Misses      11964    11970       +6     
  Partials       61       61              
Flag Coverage Δ
backend 90.71% <100.00%> (+0.01%) ⬆️

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

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

@SchrodingersGat
SchrodingersGat merged commit 3c86e8b into 1.4.x Jul 23, 2026
35 of 36 checks passed
@SchrodingersGat
SchrodingersGat deleted the backport/1.4.x/pr-12432 branch July 23, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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