Skip to content

Commit

Permalink
Make deployed_version.txt editor friendly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Anton Evers authored and Anton Evers committed Jun 11, 2017
1 parent d844e31 commit 78aba16
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
public function load()
{
if ($this->directory->isReadable($this->fileName)) {
return $this->directory->readFile($this->fileName);
return trim($this->directory->readFile($this->fileName));
}
return false;
}
Expand Down

0 comments on commit 78aba16

Please sign in to comment.