Skip to content

Commit 047771b

Browse files
committed
Merge branch 'development' into release
2 parents b537511 + c096b20 commit 047771b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+484
-392
lines changed

.github/translators.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,3 +425,7 @@ Timo B (lommes) :: German Informal
425425
Erik Lundstedt (Erik.Lundstedt) :: Swedish
426426
yngams (younessmouhid) :: Arabic
427427
Ohadp :: Hebrew
428+
cbridi :: Portuguese, Brazilian
429+
nanangsb :: Indonesian
430+
Michal Melich (michalmelich) :: Czech
431+
David (david-prv) :: German

app/Access/Saml2Service.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ public function processSlsResponse(?string $requestId): string
133133
// value so that the exact encoding format is matched when checking the signature.
134134
// This is primarily due to ADFS encoding query params with lowercase percent encoding while
135135
// PHP (And most other sensible providers) standardise on uppercase.
136+
/** @var ?string $samlRedirect */
136137
$samlRedirect = $toolkit->processSLO(true, $requestId, true, null, true);
137138
$errors = $toolkit->getErrors();
138139

app/Entities/Repos/PageRepo.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public function publishDraft(Page $draft, array $input): Page
7777
$this->updateTemplateStatusAndContentFromInput($draft, $input);
7878
$this->baseRepo->update($draft, $input);
7979

80-
$this->revisionRepo->storeNewForPage($draft, trans('entities.pages_initial_revision'));
80+
$summary = trim($input['summary'] ?? '') ?: trans('entities.pages_initial_revision');
81+
$this->revisionRepo->storeNewForPage($draft, $summary);
8182
$draft->refresh();
8283

8384
Activity::add(ActivityType::PAGE_CREATE, $draft);

app/Uploads/ImageResizer.php

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
use GuzzleHttp\Psr7\Utils;
88
use Illuminate\Support\Facades\Cache;
99
use Intervention\Image\Decoders\BinaryImageDecoder;
10+
use Intervention\Image\Drivers\Gd\Decoders\NativeObjectDecoder;
1011
use Intervention\Image\Drivers\Gd\Driver;
1112
use Intervention\Image\Encoders\AutoEncoder;
1213
use Intervention\Image\Encoders\PngEncoder;
1314
use Intervention\Image\Interfaces\ImageInterface as InterventionImage;
1415
use Intervention\Image\ImageManager;
16+
use Intervention\Image\Origin;
1517

1618
class ImageResizer
1719
{
@@ -99,7 +101,7 @@ public function resizeToThumbnailUrl(
99101
}
100102

101103
// If not in cache and thumbnail does not exist, generate thumb and cache path
102-
$thumbData = $this->resizeImageData($imageData, $width, $height, $keepRatio);
104+
$thumbData = $this->resizeImageData($imageData, $width, $height, $keepRatio, $this->getExtension($image));
103105
$disk->put($thumbFilePath, $thumbData, true);
104106
Cache::put($thumbCacheKey, $thumbFilePath, static::THUMBNAIL_CACHE_TIME);
105107

@@ -120,7 +122,7 @@ public function resizeImageData(
120122
?string $format = null,
121123
): string {
122124
try {
123-
$thumb = $this->interventionFromImageData($imageData);
125+
$thumb = $this->interventionFromImageData($imageData, $format);
124126
} catch (Exception $e) {
125127
throw new ImageUploadException(trans('errors.cannot_create_thumbs'));
126128
}
@@ -154,11 +156,23 @@ public function resizeImageData(
154156
* Performs some manual library usage to ensure image is specifically loaded
155157
* from given binary data instead of data being misinterpreted.
156158
*/
157-
protected function interventionFromImageData(string $imageData): InterventionImage
159+
protected function interventionFromImageData(string $imageData, ?string $fileType): InterventionImage
158160
{
159161
$manager = new ImageManager(new Driver());
160162

161-
return $manager->read($imageData, BinaryImageDecoder::class);
163+
// Ensure gif images are decoded natively instead of deferring to intervention GIF
164+
// handling since we don't need the added animation support.
165+
$isGif = $fileType === 'gif';
166+
$decoder = $isGif ? NativeObjectDecoder::class : BinaryImageDecoder::class;
167+
$input = $isGif ? @imagecreatefromstring($imageData) : $imageData;
168+
169+
$image = $manager->read($input, $decoder);
170+
171+
if ($isGif) {
172+
$image->setOrigin(new Origin('image/gif'));
173+
}
174+
175+
return $image;
162176
}
163177

164178
/**
@@ -209,7 +223,15 @@ protected function orientImageToOriginalExif(InterventionImage $image, string $o
209223
*/
210224
protected function isGif(Image $image): bool
211225
{
212-
return strtolower(pathinfo($image->path, PATHINFO_EXTENSION)) === 'gif';
226+
return $this->getExtension($image) === 'gif';
227+
}
228+
229+
/**
230+
* Get the extension for the given image, normalised to lower-case.
231+
*/
232+
protected function getExtension(Image $image): string
233+
{
234+
return strtolower(pathinfo($image->path, PATHINFO_EXTENSION));
213235
}
214236

215237
/**

app/Users/Controllers/RoleApiController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class RoleApiController extends ApiController
2121
'display_name' => ['required', 'string', 'min:3', 'max:180'],
2222
'description' => ['string', 'max:180'],
2323
'mfa_enforced' => ['boolean'],
24-
'external_auth_id' => ['string'],
24+
'external_auth_id' => ['string', 'max:180'],
2525
'permissions' => ['array'],
2626
'permissions.*' => ['string'],
2727
],
2828
'update' => [
2929
'display_name' => ['string', 'min:3', 'max:180'],
3030
'description' => ['string', 'max:180'],
3131
'mfa_enforced' => ['boolean'],
32-
'external_auth_id' => ['string'],
32+
'external_auth_id' => ['string', 'max:180'],
3333
'permissions' => ['array'],
3434
'permissions.*' => ['string'],
3535
]

app/Users/Controllers/RoleController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function store(Request $request)
7575
$data = $this->validate($request, [
7676
'display_name' => ['required', 'min:3', 'max:180'],
7777
'description' => ['max:180'],
78-
'external_auth_id' => ['string'],
78+
'external_auth_id' => ['string', 'max:180'],
7979
'permissions' => ['array'],
8080
'mfa_enforced' => ['string'],
8181
]);
@@ -109,7 +109,7 @@ public function update(Request $request, string $id)
109109
$data = $this->validate($request, [
110110
'display_name' => ['required', 'min:3', 'max:180'],
111111
'description' => ['max:180'],
112-
'external_auth_id' => ['string'],
112+
'external_auth_id' => ['string', 'max:180'],
113113
'permissions' => ['array'],
114114
'mfa_enforced' => ['string'],
115115
]);

0 commit comments

Comments
 (0)