Skip to content

Commit

Permalink
Fix issue with webroot. Bump to 1.2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikkel committed Feb 14, 2022
1 parent b170653 commit 617ae1c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ToolMate Changelog

## 1.2.0.1 - 2022-02-14
### Fixed
- Fixes an issue where Toolmate wasn't able to set the public web root path correctly

## 1.2.0 - 2022-02-13
### Added
- Added `Settings::csp` for configuring the Content-Security-Policy header
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vaersaagod/toolmate",
"description": "Is that a tool in your pocket, or are you just happy to see me, mate?",
"type": "craft-plugin",
"version": "1.2.0",
"version": "1.2.0.1",
"keywords": [
"craft",
"cms",
Expand Down
13 changes: 11 additions & 2 deletions src/models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use Craft;
use craft\base\Model;
use craft\helpers\App;
use craft\helpers\ConfigHelper;


/**
* ToolMate Settings Model
*
Expand Down Expand Up @@ -40,6 +40,15 @@ class Settings extends Model
*/
private $_csp;

/**
* @throws \yii\base\InvalidConfigException
*/
public function init()
{
parent::init();
$this->setAttributes($this->getAttributes(), false);
}

/**
* @param array $values
* @param bool $safeOnly
Expand All @@ -48,7 +57,7 @@ class Settings extends Model
public function setAttributes($values, $safeOnly = true)
{

$values['publicRoot'] = App::parseEnv($values['publicRoot'] ?? '@webroot');
$values['publicRoot'] = Craft::parseEnv($values['publicRoot'] ?? '@webroot');

if ($values['embedCacheDuration'] === null) {
$values['embedCacheDuration'] = Craft::$app->getConfig()->getGeneral()->cacheDuration;
Expand Down

0 comments on commit 617ae1c

Please sign in to comment.