Skip to content

Update Imagesharp #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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