From 989759fa209bc4e1d3aa9d25a0819237889abe50 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 19 Sep 2023 11:23:20 +0200 Subject: [PATCH] Updated NuGet Dependencies (#14795) * Updated nuget packages and fixed breaking changes in ImageSharp * Update to .net8 rc1 --- .../Umbraco.Cms.Api.Common.csproj | 4 +-- .../Umbraco.Cms.Imaging.ImageSharp.csproj | 2 +- .../ImageProcessors/CropWebProcessor.cs | 2 +- .../Media/ImageSharpDimensionExtractor.cs | 26 ++++++++++++------- .../Umbraco.Cms.Imaging.ImageSharp2.csproj | 2 +- ...co.Cms.Persistence.EFCore.SqlServer.csproj | 2 +- ...braco.Cms.Persistence.EFCore.Sqlite.csproj | 2 +- .../Umbraco.Cms.Persistence.EFCore.csproj | 8 +++--- .../Umbraco.Cms.Persistence.Sqlite.csproj | 2 +- src/Umbraco.Core/Umbraco.Core.csproj | 22 ++++++++-------- .../Umbraco.Infrastructure.csproj | 24 ++++++++--------- .../Umbraco.PublishedCache.NuCache.csproj | 4 +-- .../Umbraco.Web.Common.csproj | 8 +++--- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 +- .../misc/umbraco-linux.docker | 4 +-- .../Umbraco.Tests.Benchmarks.csproj | 4 +-- .../Umbraco.Tests.Integration.csproj | 4 +-- .../Umbraco.Tests.UnitTests.csproj | 8 +++--- 18 files changed, 68 insertions(+), 62 deletions(-) diff --git a/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj b/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj index c739e23335..b98abf4af9 100644 --- a/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj +++ b/src/Umbraco.Cms.Api.Common/Umbraco.Cms.Api.Common.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/src/Umbraco.Cms.Imaging.ImageSharp/Umbraco.Cms.Imaging.ImageSharp.csproj b/src/Umbraco.Cms.Imaging.ImageSharp/Umbraco.Cms.Imaging.ImageSharp.csproj index c34595576f..db7ac432bc 100644 --- a/src/Umbraco.Cms.Imaging.ImageSharp/Umbraco.Cms.Imaging.ImageSharp.csproj +++ b/src/Umbraco.Cms.Imaging.ImageSharp/Umbraco.Cms.Imaging.ImageSharp.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/Umbraco.Cms.Imaging.ImageSharp2/ImageProcessors/CropWebProcessor.cs b/src/Umbraco.Cms.Imaging.ImageSharp2/ImageProcessors/CropWebProcessor.cs index eda49fa9d0..3546fa518a 100644 --- a/src/Umbraco.Cms.Imaging.ImageSharp2/ImageProcessors/CropWebProcessor.cs +++ b/src/Umbraco.Cms.Imaging.ImageSharp2/ImageProcessors/CropWebProcessor.cs @@ -64,7 +64,7 @@ public class CropWebProcessor : IImageWebProcessor Vector2 xy2 = ExifOrientationUtilities.Transform(new Vector2(right, bottom), Vector2.Zero, Vector2.One, orientation); // Scale points to a pixel based rectangle - Size size = image.Image.Size(); + Size size = image.Image.Size; return Rectangle.Round(RectangleF.FromLTRB( MathF.Min(xy1.X, xy2.X) * size.Width, diff --git a/src/Umbraco.Cms.Imaging.ImageSharp2/Media/ImageSharpDimensionExtractor.cs b/src/Umbraco.Cms.Imaging.ImageSharp2/Media/ImageSharpDimensionExtractor.cs index 409b6e2726..f4b2c5c32c 100644 --- a/src/Umbraco.Cms.Imaging.ImageSharp2/Media/ImageSharpDimensionExtractor.cs +++ b/src/Umbraco.Cms.Imaging.ImageSharp2/Media/ImageSharpDimensionExtractor.cs @@ -1,4 +1,5 @@ using SixLabors.ImageSharp; +using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Metadata.Profiles.Exif; using Umbraco.Cms.Core.Media; using Size = System.Drawing.Size; @@ -7,7 +8,7 @@ namespace Umbraco.Cms.Imaging.ImageSharp.Media; public sealed class ImageSharpDimensionExtractor : IImageDimensionExtractor { - private readonly Configuration _configuration; + private readonly DecoderOptions _decoderOptions; /// public IEnumerable SupportedImageFileTypes { get; } @@ -15,12 +16,12 @@ public sealed class ImageSharpDimensionExtractor : IImageDimensionExtractor /// /// Initializes a new instance of the class. /// - /// The configuration. - public ImageSharpDimensionExtractor(Configuration configuration) + /// The configuration. + public ImageSharpDimensionExtractor(DecoderOptions decoderOptions) { - _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); + _decoderOptions = decoderOptions ?? throw new ArgumentNullException(nameof(decoderOptions)); - SupportedImageFileTypes = configuration.ImageFormats.SelectMany(f => f.FileExtensions).ToArray(); + SupportedImageFileTypes = decoderOptions.Configuration.ImageFormats.SelectMany(f => f.FileExtensions).ToArray(); } /// @@ -28,7 +29,12 @@ public sealed class ImageSharpDimensionExtractor : IImageDimensionExtractor { Size? size = null; - IImageInfo imageInfo = Image.Identify(_configuration, stream); + if (stream == null) + { + return size; + } + + ImageInfo imageInfo = Image.Identify(_decoderOptions, stream); if (imageInfo != null) { size = IsExifOrientationRotated(imageInfo) @@ -39,7 +45,7 @@ public sealed class ImageSharpDimensionExtractor : IImageDimensionExtractor return size; } - private static bool IsExifOrientationRotated(IImageInfo imageInfo) + private static bool IsExifOrientationRotated(ImageInfo imageInfo) => GetExifOrientation(imageInfo) switch { ExifOrientationMode.LeftTop @@ -49,10 +55,10 @@ public sealed class ImageSharpDimensionExtractor : IImageDimensionExtractor _ => false, }; - private static ushort GetExifOrientation(IImageInfo imageInfo) + private static ushort GetExifOrientation(ImageInfo imageInfo) { - IExifValue? orientation = imageInfo.Metadata.ExifProfile?.GetValue(ExifTag.Orientation); - if (orientation is not null) + + if(imageInfo.Metadata.ExifProfile != null && imageInfo.Metadata.ExifProfile.TryGetValue(ExifTag.Orientation, out IExifValue? orientation)) { if (orientation.DataType == ExifDataType.Short) { diff --git a/src/Umbraco.Cms.Imaging.ImageSharp2/Umbraco.Cms.Imaging.ImageSharp2.csproj b/src/Umbraco.Cms.Imaging.ImageSharp2/Umbraco.Cms.Imaging.ImageSharp2.csproj index 14c203bad6..c7b75ee4e3 100644 --- a/src/Umbraco.Cms.Imaging.ImageSharp2/Umbraco.Cms.Imaging.ImageSharp2.csproj +++ b/src/Umbraco.Cms.Imaging.ImageSharp2/Umbraco.Cms.Imaging.ImageSharp2.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj index e2e30619a2..e0e6b794ce 100644 --- a/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore.SqlServer/Umbraco.Cms.Persistence.EFCore.SqlServer.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj index b3452eb67c..5980608a92 100644 --- a/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore.Sqlite/Umbraco.Cms.Persistence.EFCore.Sqlite.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj b/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj index a43e8f803c..ea1b528a3b 100644 --- a/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj +++ b/src/Umbraco.Cms.Persistence.EFCore/Umbraco.Cms.Persistence.EFCore.csproj @@ -5,10 +5,10 @@ - - - - + + + + diff --git a/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj b/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj index bc6437e58c..3abb269100 100644 --- a/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj +++ b/src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 1f79d50278..a82b7c8384 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -7,24 +7,24 @@ - - - - - - - - - + + + + + + + + + - + - + diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index c1f344f2c1..d4c4afcf71 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -12,33 +12,33 @@ - - + + - - - - - + + + + + - + - + - + - - + + diff --git a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj index a35d9a2c23..5eb8a7a62e 100644 --- a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj +++ b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj @@ -7,9 +7,9 @@ - + - + diff --git a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj index 3263a75a1b..e0df7f29bd 100644 --- a/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj +++ b/src/Umbraco.Web.Common/Umbraco.Web.Common.csproj @@ -7,11 +7,11 @@ - - + + - - + + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 58e2f0a165..e7946af22e 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -18,7 +18,7 @@ - + all diff --git a/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker b/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker index 2844f7bdc7..fda51841a6 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker +++ b/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker @@ -2,7 +2,7 @@ ## Build ############################################ -FROM mcr.microsoft.com/dotnet/nightly/sdk:8.0.100-preview.7-jammy AS build +FROM mcr.microsoft.com/dotnet/nightly/sdk:8.0.100-rc.1-jammy AS build COPY nuget.config . @@ -22,7 +22,7 @@ RUN dotnet publish --configuration Release --no-build --output /dist ## Run ############################################ -FROM mcr.microsoft.com/dotnet/nightly/aspnet:8.0.0-preview.7-jammy AS run +FROM mcr.microsoft.com/dotnet/nightly/aspnet:8.0.0-rc.1-jammy AS run WORKDIR /app COPY --from=build dist . diff --git a/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj b/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj index f00868f6c2..834cbb0f1c 100644 --- a/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj +++ b/tests/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj @@ -4,8 +4,8 @@ - - + + diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj b/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj index 0a3ca65c85..3c5e4bb437 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj +++ b/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj index 4e45c42f88..91aad5d367 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj @@ -5,11 +5,11 @@ - - + + - - + +