diff --git a/CHANGELOG.md b/CHANGELOG.md index 62ea2c52f9..4d9f41776a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 9.4.4 - 2020-10-19 + +### Fixed +- Escape inline attributes [#1313](https://github.com/orchidsoftware/platform/pull/1313) + ## 9.4.3 - 2020-10-17 ### Changed diff --git a/src/Platform/Dashboard.php b/src/Platform/Dashboard.php index 9f8c926a69..d81d6c61bc 100644 --- a/src/Platform/Dashboard.php +++ b/src/Platform/Dashboard.php @@ -17,7 +17,7 @@ class Dashboard /** * ORCHID Version. */ - public const VERSION = '9.4.3'; + public const VERSION = '9.4.4'; /** * The Dashboard configuration options. diff --git a/src/Screen/Field.php b/src/Screen/Field.php index 4d74e86010..e705ce4d7b 100644 --- a/src/Screen/Field.php +++ b/src/Screen/Field.php @@ -245,11 +245,13 @@ protected function getAllowAttributes(): ComponentAttributeBag { $allow = array_merge($this->universalAttributes, $this->inlineAttributes); - $attribute = new ComponentAttributeBag($this->getAttributes()); + $attributes = collect($this->getAttributes()) + ->filter(function ($value, $attribute) use ($allow) { + return Str::is($allow, $attribute); + })->toArray(); - return $attribute->filter(function ($value, $attribute) use ($allow) { - return Str::is($allow, $attribute); - }); + return (new ComponentAttributeBag()) + ->merge($attributes); } /** diff --git a/src/Screen/Fields/Upload.php b/src/Screen/Fields/Upload.php index 33389b34e1..4e09b0fbd1 100644 --- a/src/Screen/Fields/Upload.php +++ b/src/Screen/Fields/Upload.php @@ -81,7 +81,6 @@ class Upload extends Field 'multiple', 'placeholder', 'required', - 'value', 'groups', 'storage', 'media', diff --git a/tests/Unit/Screen/Fields/InputTest.php b/tests/Unit/Screen/Fields/InputTest.php index 32f55201ca..91571ad1d4 100644 --- a/tests/Unit/Screen/Fields/InputTest.php +++ b/tests/Unit/Screen/Fields/InputTest.php @@ -68,4 +68,18 @@ public function testDataAttributes(): void $this->assertStringContainsString('data-location="Russia"', $input); $this->assertStringContainsString('data-hello="world!"', $input); } + + public function testEscapeAttributes(): void + { + $input = (string) Input::make('name')->value('valueQuote"'); + + $this->assertStringContainsString('value="valueQuote""', $input); + } + + public function testRemoveBooleanAttributes(): void + { + $input = (string) Input::make('name')->required(false); + + $this->assertStringNotContainsString('required', $input); + } }