From 072c0140554ac826468996750629e210d1c5ec1c Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Mon, 8 Apr 2019 20:59:12 +0200 Subject: [PATCH 1/2] Read image dimensions via GDI if EXIF fails with an exception --- src/Umbraco.Core/IO/MediaFileSystem.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Core/IO/MediaFileSystem.cs b/src/Umbraco.Core/IO/MediaFileSystem.cs index a4305506bb..d843b95709 100644 --- a/src/Umbraco.Core/IO/MediaFileSystem.cs +++ b/src/Umbraco.Core/IO/MediaFileSystem.cs @@ -377,21 +377,28 @@ namespace Umbraco.Core.IO return new Size(width, height); } } + } + catch + { + //We will just swallow, just means we can't read exif data, we don't want to log an error either + } - //we have no choice but to try to read in via GDI + //we have no choice but to try to read in via GDI + try + { using (var image = Image.FromStream(stream)) { - var fileWidth = image.Width; var fileHeight = image.Height; return new Size(fileWidth, fileHeight); } } - catch (Exception) + catch { - //We will just swallow, just means we can't read exif data, we don't want to log an error either - return new Size(Constants.Conventions.Media.DefaultSize, Constants.Conventions.Media.DefaultSize); + //We will just swallow, just means we can't read via GDI, we don't want to log an error either } + + return new Size(Constants.Conventions.Media.DefaultSize, Constants.Conventions.Media.DefaultSize); } #endregion From c35a3fa7021f5f700e89a90209290be3d9e63703 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Sun, 21 Apr 2019 13:19:29 +0200 Subject: [PATCH 2/2] Send notifications for rollbacks --- src/Umbraco.Web/Strategies/NotificationsHandler.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Umbraco.Web/Strategies/NotificationsHandler.cs b/src/Umbraco.Web/Strategies/NotificationsHandler.cs index a085bd463a..a01fba3c94 100644 --- a/src/Umbraco.Web/Strategies/NotificationsHandler.cs +++ b/src/Umbraco.Web/Strategies/NotificationsHandler.cs @@ -73,6 +73,10 @@ namespace Umbraco.Web.Strategies applicationContext.Services.NotificationService.SendNotification( content, ActionUnPublish.Instance, applicationContext)); + //Send notifications for the rollback action + ContentService.RolledBack += (sender, args) => applicationContext.Services.NotificationService.SendNotification( + args.Entity, ActionRollback.Instance, applicationContext + ); } }