Skip to content

Commit eef8ae1

Browse files
Merge pull request #345 from SixLabors/js/update-imagesharp
Update Imagesharp
2 parents 2ac2e3c + 17aae94 commit eef8ae1

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

src/ImageSharp.Web/Commands/Converters/ColorConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public Color ConvertFrom(CommandParser parser, CultureInfo culture, string? valu
5050

5151
// Numeric r,g,b - r,g,b,a
5252
char separator = ConverterUtility.GetListSeparator(culture);
53-
if (value.IndexOf(separator) != -1)
53+
if (value.Contains(separator))
5454
{
5555
string[] components = value.Split(separator);
5656

src/ImageSharp.Web/Commands/Converters/EnumConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public sealed class EnumConverter : ICommandConverter<object>
3535
try
3636
{
3737
char separator = ConverterUtility.GetListSeparator(culture);
38-
if (value.IndexOf(separator) != -1)
38+
if (value.Contains(separator))
3939
{
4040
long convertedValue = 0;
4141
foreach (string pill in GetStringArray(value, separator))

src/ImageSharp.Web/Commands/PresetOnlyQueryCollectionRequestParser.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,13 @@ private static IDictionary<string, CommandCollection> ParsePresets(
5858

5959
private static CommandCollection ParsePreset(string unparsedPresetValue)
6060
{
61-
// TODO: Investigate skipping the double allocation here.
62-
// In .NET 6 we can directly use the QueryStringEnumerable type and enumerate stright to our command collection
63-
Dictionary<string, StringValues> parsed = QueryHelpers.ParseQuery(unparsedPresetValue);
6461
CommandCollection transformed = new();
65-
foreach (KeyValuePair<string, StringValues> pair in parsed)
62+
foreach (QueryStringEnumerable.EncodedNameValuePair pair in new QueryStringEnumerable(unparsedPresetValue))
6663
{
67-
// Use the indexer for both set and query. This replaces any previously parsed values.
68-
string? value = pair.Value[^1];
69-
if (value is not null)
64+
// Last value wins.
65+
if (pair.DecodeValue().Length > 0)
7066
{
71-
transformed[pair.Key] = value;
67+
transformed[pair.DecodeName().ToString()] = pair.DecodeValue().ToString();
7268
}
7369
}
7470

src/ImageSharp.Web/FormattedImage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ internal static async Task<FormattedImage> LoadAsync(DecoderOptions options, Str
127127
internal void Save(Stream destination) => this.Image.Save(destination, this.encoder);
128128

129129
/// <summary>
130-
/// Gets the EXIF orientation metata for the <see cref="FormattedImage"/>.
130+
/// Gets the EXIF orientation metadata for the <see cref="FormattedImage"/>.
131131
/// </summary>
132132
/// <param name="value">
133133
/// When this method returns, contains the value parsed from decoded EXIF metadata; otherwise,

src/ImageSharp.Web/ImageSharp.Web.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<ItemGroup>
4747
<FrameworkReference Include="Microsoft.AspNetCore.App" />
4848
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
49-
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.0-alpha.0.43" />
49+
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.0" />
5050
</ItemGroup>
5151

5252
<Import Project="..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label="Shared" />

0 commit comments

Comments
 (0)