Skip to content

Commit

Permalink
Merge pull request #345 from SixLabors/js/update-imagesharp
Browse files Browse the repository at this point in the history
Update Imagesharp
  • Loading branch information
JimBobSquarePants authored Dec 5, 2023
2 parents 2ac2e3c + 17aae94 commit eef8ae1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ImageSharp.Web/Commands/Converters/ColorConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Color ConvertFrom(CommandParser parser, CultureInfo culture, string? valu

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

Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Web/Commands/Converters/EnumConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public sealed class EnumConverter : ICommandConverter<object>
try
{
char separator = ConverterUtility.GetListSeparator(culture);
if (value.IndexOf(separator) != -1)
if (value.Contains(separator))
{
long convertedValue = 0;
foreach (string pill in GetStringArray(value, separator))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,13 @@ private static IDictionary<string, CommandCollection> ParsePresets(

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

Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Web/FormattedImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ internal static async Task<FormattedImage> LoadAsync(DecoderOptions options, Str
internal void Save(Stream destination) => this.Image.Save(destination, this.encoder);

/// <summary>
/// Gets the EXIF orientation metata for the <see cref="FormattedImage"/>.
/// Gets the EXIF orientation metadata for the <see cref="FormattedImage"/>.
/// </summary>
/// <param name="value">
/// When this method returns, contains the value parsed from decoded EXIF metadata; otherwise,
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp.Web/ImageSharp.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.0-alpha.0.43" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.0" />
</ItemGroup>

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

0 comments on commit eef8ae1

Please sign in to comment.