Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 77a95be

Browse files
Release 2.4.0 (#1182)
* Parent + Nested validation changes (#1138) * Issue Fix #1109 (#1146) * Added file support for 7.0 (Explained) (#1124) * Bump version to 2.3.0 (#1120) * Added file support for 7.0 (Explained) Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin. Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt. Explained here: https://stackoverflow.com/a/51568547 * Issue Fix #1114 (#1128) * Issue Fix #1114 * Change exception message * Update .gitignore (#1129) * Bump version to 2.3.0 (#1120) * Update .gitignore * Update .gitignore * Update .gitignore * Update .gitignore * Issue Fix #1125 (#1134) * Issue Fix #1131 (#1135) * create thumb for pdf if imagick is available (#1123) * Bump version to 2.3.0 (#1120) * create thumb for pdf if imagick is available * Issue Fix #1109 * Add Special characters in the radom string generator * Issue Fix #1109 * Remove other option * Imagick changes * Update logo without page refresh (#1162) * Resolve the error of validation of primary key (#1166) * Don't use special characters in creation of project auth tokens (#1169) * Comment PHP variables in htaccess. (#1145) * Added file support for 7.0 (Explained) (#1124) * Bump version to 2.3.0 (#1120) * Added file support for 7.0 (Explained) Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin. Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt. Explained here: https://stackoverflow.com/a/51568547 * Issue Fix #1114 (#1128) * Issue Fix #1114 * Change exception message * Update .gitignore (#1129) * Bump version to 2.3.0 (#1120) * Update .gitignore * Update .gitignore * Update .gitignore * Update .gitignore * Issue Fix #1125 (#1134) * Issue Fix #1131 (#1135) * create thumb for pdf if imagick is available (#1123) * Bump version to 2.3.0 (#1120) * create thumb for pdf if imagick is available * Remove warning of undefined index size (#1140) * Add thumbnails for PDF. (#1141) * Remove PHP vaeiable from htaccess. * Update .htaccess * Update public/.htaccess Co-Authored-By: Rijk van Zanten <[email protected]> * Issue Fix #1161 (#1165) * Issue fix #1161 * Check for O2M * Add option to prevent upsizing contained thumbnails. (#1168) * Issue Fix #1170 (#1175) * Release 2.3.1 (#1158) * Parent + Nested validation changes (#1138) * #1121 (#1126) * Public Role : UserId should be set 0 instead of null * Change : invalid token * Issue Fix #1109 (#1146) * Added file support for 7.0 (Explained) (#1124) * Bump version to 2.3.0 (#1120) * Added file support for 7.0 (Explained) Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin. Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt. Explained here: https://stackoverflow.com/a/51568547 * Issue Fix #1114 (#1128) * Issue Fix #1114 * Change exception message * Update .gitignore (#1129) * Bump version to 2.3.0 (#1120) * Update .gitignore * Update .gitignore * Update .gitignore * Update .gitignore * Issue Fix #1125 (#1134) * Issue Fix #1131 (#1135) * create thumb for pdf if imagick is available (#1123) * Bump version to 2.3.0 (#1120) * create thumb for pdf if imagick is available * Issue Fix #1109 * Add Special characters in the radom string generator * Issue Fix #1109 * Remove other option * Imagick changes * Issue Fix #1148 (#1152) * Fix 1149 (#1156) * Process relation & non relatinal fields sequentially to solve logical operator issue * Process relation & non relatinal fields sequentially to solve logical operator issue * Fixed namespace of InvalidLoggerConfigurationException (#1153) * Bump version to v2.3.1 * Merge conflict resolve * Issue Fix #1170 * Rebase files * Issue fix/1176 (#1177) * added array type to schema (#1163) * Parent + Nested validation changes (#1138) * #1121 (#1126) * Public Role : UserId should be set 0 instead of null * Change : invalid token * Issue Fix #1109 (#1146) * Added file support for 7.0 (Explained) (#1124) * Bump version to 2.3.0 (#1120) * Added file support for 7.0 (Explained) Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin. Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt. Explained here: https://stackoverflow.com/a/51568547 * Issue Fix #1114 (#1128) * Issue Fix #1114 * Change exception message * Update .gitignore (#1129) * Bump version to 2.3.0 (#1120) * Update .gitignore * Update .gitignore * Update .gitignore * Update .gitignore * Issue Fix #1125 (#1134) * Issue Fix #1131 (#1135) * create thumb for pdf if imagick is available (#1123) * Bump version to 2.3.0 (#1120) * create thumb for pdf if imagick is available * Issue Fix #1109 * Add Special characters in the radom string generator * Issue Fix #1109 * Remove other option * Imagick changes * Issue Fix #1148 (#1152) * Fix 1149 (#1156) * Process relation & non relatinal fields sequentially to solve logical operator issue * Process relation & non relatinal fields sequentially to solve logical operator issue * Fixed namespace of InvalidLoggerConfigurationException (#1153) * added array type to schema * Update logo without page refresh (#1162) * skipped schema validation for config from api.php * Resolve the error of validation of primary key (#1166) * Don't use special characters in creation of project auth tokens (#1169) * Comment PHP variables in htaccess. (#1145) * Added file support for 7.0 (Explained) (#1124) * Bump version to 2.3.0 (#1120) * Added file support for 7.0 (Explained) Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin. Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt. Explained here: https://stackoverflow.com/a/51568547 * Issue Fix #1114 (#1128) * Issue Fix #1114 * Change exception message * Update .gitignore (#1129) * Bump version to 2.3.0 (#1120) * Update .gitignore * Update .gitignore * Update .gitignore * Update .gitignore * Issue Fix #1125 (#1134) * Issue Fix #1131 (#1135) * create thumb for pdf if imagick is available (#1123) * Bump version to 2.3.0 (#1120) * create thumb for pdf if imagick is available * Remove warning of undefined index size (#1140) * Add thumbnails for PDF. (#1141) * Remove PHP vaeiable from htaccess. * Update .htaccess * Update public/.htaccess Co-Authored-By: Rijk van Zanten <[email protected]> * Issue Fix #1161 (#1165) * Issue fix #1161 * Check for O2M * Add option to prevent upsizing contained thumbnails. (#1168) * Issue Fix #1170 (#1175) * Release 2.3.1 (#1158) * Parent + Nested validation changes (#1138) * #1121 (#1126) * Public Role : UserId should be set 0 instead of null * Change : invalid token * Issue Fix #1109 (#1146) * Added file support for 7.0 (Explained) (#1124) * Bump version to 2.3.0 (#1120) * Added file support for 7.0 (Explained) Having `public` in front of `const` completely breaks the application for `PHP 7.0` usage, which broke everything when I pulled origin. Though I understand `PHP 7.0` isn't officially supported, and that `PHP 7.1+` is, there is no reason to use public alongside const as the default visibility of class constants are public. We might as well provide support where possible if it doesn't hurt. Explained here: https://stackoverflow.com/a/51568547 * Issue Fix #1114 (#1128) * Issue Fix #1114 * Change exception message * Update .gitignore (#1129) * Bump version to 2.3.0 (#1120) * Update .gitignore * Update .gitignore * Update .gitignore * Update .gitignore * Issue Fix #1125 (#1134) * Issue Fix #1131 (#1135) * create thumb for pdf if imagick is available (#1123) * Bump version to 2.3.0 (#1120) * create thumb for pdf if imagick is available * Issue Fix #1109 * Add Special characters in the radom string generator * Issue Fix #1109 * Remove other option * Imagick changes * Issue Fix #1148 (#1152) * Fix 1149 (#1156) * Process relation & non relatinal fields sequentially to solve logical operator issue * Process relation & non relatinal fields sequentially to solve logical operator issue * Fixed namespace of InvalidLoggerConfigurationException (#1153) * Bump version to v2.3.1 * Merge conflict resolve * Issue Fix #1170 * Rebase files * added new config key "ext" for all external config with type ARRAY. added tests. * made "ext" key optional * Issue fix/1176 (#1177) * Issue fix #1179 (#1181) * Release v2.4.0
1 parent bf1330e commit 77a95be

File tree

23 files changed

+206
-171
lines changed

23 files changed

+206
-171
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@directus/api",
33
"private": true,
4-
"version": "2.3.1",
4+
"version": "2.4.0",
55
"description": "Directus API",
66
"main": "index.js",
77
"repository": "directus/api",

public/.htaccess

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Options +SymLinksIfOwnerMatch
2020
RewriteRule !^admin index.php?%{QUERY_STRING} [L]
2121
</ifModule>
2222

23-
<IfModule mod_php7.c>
24-
php_value upload_max_filesize 50M
25-
php_value post_max_size 100M
26-
</IfModule>
23+
# Uncomment the following lines to modify PHP settings. The lines below can be used to increase the max upload size of files in Directus
24+
#<IfModule mod_php7.c>
25+
#php_value upload_max_filesize 50M
26+
#php_value post_max_size 100M
27+
#</IfModule>

src/core/Directus/Application/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Application extends App
1313
*
1414
* @var string
1515
*/
16-
const DIRECTUS_VERSION = '2.3.1';
16+
const DIRECTUS_VERSION = '2.4.0';
1717

1818
/**
1919
* NOT USED

src/core/Directus/Config/Schema/Base.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,17 @@ public function optional($value = null)
113113
}
114114
return $this->_optional;
115115
}
116+
117+
/**
118+
* Returns the $context with normalized array keys.
119+
* @param $context
120+
* @return mixed
121+
*/
122+
protected function normalize($context) {
123+
foreach ($context as $context_key => $context_value) {
124+
$context[strtolower(str_replace("-", "", str_replace("_", "", $context_key)))] = $context_value;
125+
}
126+
127+
return $context;
128+
}
116129
}

src/core/Directus/Config/Schema/Group.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ public function value($context)
2525
$value = [];
2626
$current = [];
2727

28-
foreach ($context as $context_key => $context_value) {
29-
$context[strtolower(str_replace("-", "", str_replace("_", "", $context_key)))] = $context_value;
30-
}
28+
$context = $this->normalize($context);
3129

3230
if (!isset($context[$this->key()])) {
3331
if ($this->optional()) {

src/core/Directus/Config/Schema/Schema.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ public static function get() {
7777
]),
7878
new Group('cors', [
7979
new Value('enabled', Types::BOOLEAN, true),
80-
new Value('origin', 'array', ['*']),
81-
new Value('methods', 'array', [
80+
new Value('origin', Types::ARRAY, ['*']),
81+
new Value('methods', Types::ARRAY, [
8282
'GET',
8383
'POST',
8484
'PUT',
8585
'PATCH',
8686
'DELETE',
8787
'HEAD'
8888
]),
89-
new Value('headers', 'array', []),
90-
new Value('exposed_headers', 'array', []),
89+
new Value('headers', Types::ARRAY, []),
90+
new Value('exposed_headers', Types::ARRAY, []),
9191
new Value('max_age', Types::INTEGER, null),
9292
new Value('credentials', Types::BOOLEAN, false),
9393
]),
@@ -101,14 +101,14 @@ public static function get() {
101101
new Value('timeout', Types::INTEGER, 10),
102102
]),
103103
new Group('hooks', [
104-
new Value('actions', 'array', []),
105-
new Value('filters', 'array', []),
104+
new Value('actions', Types::ARRAY, []),
105+
new Value('filters', Types::ARRAY, []),
106106
]),
107107
new Group('feedback', [
108108
new Value('token', Types::STRING, 'a-kind-of-unique-token'),
109109
new Value('login', Types::STRING, true),
110110
]),
111-
new Value('tableBlacklist', 'array', []),
111+
new Value('tableBlacklist', Types::ARRAY, []),
112112
new Group('auth', [
113113
new Value('secret_key', Types::STRING, '<type-a-secret-authentication-key-string>'),
114114
new Value('public_key', Types::STRING, '<type-a-public-authentication-key-string>'),
@@ -139,6 +139,7 @@ public static function get() {
139139
]),
140140
]),
141141
]),
142+
new Value('ext?', Types::ARRAY, []),
142143
]);
143144
}
144145
}

src/core/Directus/Config/Schema/Types.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ interface Types
1111
const FLOAT = 'float';
1212
const STRING = 'string';
1313
const BOOLEAN = 'boolean';
14+
const ARRAY = 'array';
1415
}

src/core/Directus/Config/Schema/Value.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public function __construct($name, $type, $default = null)
3535
*/
3636
public function value($context)
3737
{
38-
foreach ($context as $context_key => $context_value) {
39-
$context[strtolower(str_replace("-", "", str_replace("_", "", $context_key)))] = $context_value;
40-
}
38+
$context = $this->normalize($context);
4139

4240
if (!isset($context) || !isset($context[$this->key()])) {
4341
if ($this->optional()) {
@@ -50,19 +48,20 @@ public function value($context)
5048
$value = $context[$this->key()];
5149

5250
switch ($this->_type) {
53-
case Types::INTEGER:
54-
return intval($value);
55-
case Types::BOOLEAN:
56-
$value = strtolower($value);
57-
return $value === "true" || $value === "1" || $value === "on" || $value === "yes" || boolval($value);
58-
case Types::FLOAT:
59-
return floatval($value);
60-
// TODO: add support to arrays
61-
case 'array':
62-
return $this->_default;
63-
case Types::STRING:
64-
default:
65-
return $value;
51+
case Types::INTEGER:
52+
return intval($value);
53+
case Types::BOOLEAN:
54+
$value = strtolower($value);
55+
return $value === "true" || $value === "1" || $value === "on" || $value === "yes" || boolval($value);
56+
case Types::FLOAT:
57+
return floatval($value);
58+
case Types::ARRAY:
59+
if (!is_array($value)) {
60+
return $this->_default;
61+
}
62+
case Types::STRING:
63+
default:
64+
return $value;
6665
}
6766
}
6867
}

src/core/Directus/Filesystem/Files.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ public function saveData($fileData, $fileName, $replace = false)
259259
// When file is uploaded via multipart form data then We will get object of Slim\Http\UploadFile
260260
// When file is uploaded via URL (Youtube, Vimeo, or image link) then we will get base64 encode string.
261261
$size = null;
262+
263+
$title = $fileName;
264+
262265
if (is_object($fileData)) {
263266
$size = $fileData->getSize();
264267
$checksum = hash_file('md5', $fileData->file);
@@ -281,7 +284,7 @@ public function saveData($fileData, $fileName, $replace = false)
281284
unset($fileData);
282285

283286
$fileData = $this->getFileInfo($fileName);
284-
$fileData['title'] = Formatting::fileNameToFileTitle($fileName);
287+
$fileData['title'] = Formatting::fileNameToFileTitle($title);
285288
$fileData['filename'] = basename($filePath);
286289
$fileData['storage'] = $this->config['adapter'];
287290

src/core/Directus/Filesystem/Thumbnailer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,12 @@ public function contain()
179179
// crop image
180180
$img->resize($this->width, $this->height, function ($constraint) {
181181
$constraint->aspectRatio();
182+
if (ArrayUtils::get($options, 'preventUpsize')) {
183+
$constraint->upsize();
184+
}
182185
});
183186

184-
if( ArrayUtils::get($options, 'resizeCanvas')) {
187+
if (ArrayUtils::get($options, 'resizeCanvas')) {
185188
$img->resizeCanvas($this->width, $this->height, ArrayUtils::get($options, 'position', 'center'), ArrayUtils::get($options, 'resizeRelative', false), ArrayUtils::get($options, 'canvasBackground', [255, 255, 255, 0]));
186189
}
187190

0 commit comments

Comments
 (0)