Skip to content

Trim deployment version in Version\\Storage\\File::load()#40621

Open
Genaker wants to merge 3 commits intomagento:2.4-developfrom
Genaker:fix/deployed-version-storage-trim
Open

Trim deployment version in Version\\Storage\\File::load()#40621
Genaker wants to merge 3 commits intomagento:2.4-developfrom
Genaker:fix/deployed-version-storage-trim

Conversation

@Genaker
Copy link
Copy Markdown
Contributor

@Genaker Genaker commented Mar 24, 2026

Description

pub/static/deployed_version.txt is read verbatim in Version\Storage\File::load(). A trailing newline (common when the file is written with a shell redirect or some editors) becomes part of the deployment version string and breaks static view URLs (/static/version…/…), including JSON that embeds those URLs (e.g. body data-mage-init for the loader icon).

Manual testing scenarios

  • deployed_version.txt contains only digits + trailing \n → static URLs and JSON.parse on data-mage-init succeed.
  • No deployed_version.txt / file unreadable → unchanged (false).

Fixes #40620

Trailing newlines in pub/static/deployed_version.txt (e.g. from scripts or editors)
were included in the version segment, breaking static URLs and JSON that embeds
them (e.g. body data-mage-init loader icon).

Refs magento#40620
@m2-assistant
Copy link
Copy Markdown

m2-assistant bot commented Mar 24, 2026

Hi @Genaker. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.
❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@engcom-Hotel engcom-Hotel added Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it Priority: P3 May be fixed according to the position in the backlog. labels Mar 24, 2026
@github-project-automation github-project-automation bot moved this to Pending Review in Pull Requests Dashboard Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: P3 May be fixed according to the position in the backlog. Progress: pending review Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Projects

Status: Pending Review

Development

Successfully merging this pull request may close these issues.

trim() deployment version in Version\\Storage\\File::load() — trailing newline in deployed_version.txt breaks static URLs

3 participants