Skip to content

Commit 78aba16

Browse files
Anton EversAnton Evers
authored andcommitted
Make deployed_version.txt editor friendly
In production environments with a CDN for static files it comes in handy that you can force a browser cache refresh by changing the number manually without having to go into maintenance for a full deploy. If you edit the `pub/static/deployed_version.txt` with vim, nano or `echo '123456789' > pub/static/deployed_version.txt` you can unintentionally create a newline at the end of the file. This will result in: ```html var BASE_URL = 'https://magento2.dev/sitemanager/admin/index/index/key/ec38dd3ded42b71db14166d6bcdfc56d4e7d4b7801b9808373ae4b3563b65513/'; var FORM_KEY = 'dKArsQU6NhimXr6Z'; var require = { "baseUrl": "https://magento2.dev/pub/static/version1492766286 /adminhtml/Magento/backend/en_US" }; ``` With that baseUrl all resources using baseUrl will return the 404 page. Adding a simple `trim()` here will remove that risk.
1 parent d844e31 commit 78aba16

File tree

1 file changed

+1
-1
lines changed
  • lib/internal/Magento/Framework/App/View/Deployment/Version/Storage

1 file changed

+1
-1
lines changed

lib/internal/Magento/Framework/App/View/Deployment/Version/Storage/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
public function load()
4242
{
4343
if ($this->directory->isReadable($this->fileName)) {
44-
return $this->directory->readFile($this->fileName);
44+
return trim($this->directory->readFile($this->fileName));
4545
}
4646
return false;
4747
}

0 commit comments

Comments
 (0)