Browse Source
Fix for setting image height and width metadata (#857)
This was raised by SonarQube; it detected identical expressions on both sides of the operator.
pull/860/head
Paul Astbury-Thomas
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
1 deletions
-
backend/src/Squidex.Domain.Apps.Entities/Assets/FileTagAssetMetadataSource.cs
-
backend/tests/Squidex.Domain.Apps.Entities.Tests/Assets/FileTagAssetMetadataSourceTests.cs
|
|
|
@ -77,7 +77,7 @@ namespace Squidex.Domain.Apps.Entities.Assets |
|
|
|
var pw = file.Properties.PhotoWidth; |
|
|
|
var ph = file.Properties.PhotoHeight; |
|
|
|
|
|
|
|
if (pw > 0 && pw > 0) |
|
|
|
if (pw > 0 && ph > 0) |
|
|
|
{ |
|
|
|
command.Metadata.SetPixelWidth(pw); |
|
|
|
command.Metadata.SetPixelHeight(ph); |
|
|
|
|
|
|
|
@ -40,6 +40,17 @@ namespace Squidex.Domain.Apps.Entities.Assets |
|
|
|
Assert.Equal(170, command.Metadata.GetPixelHeight()); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_not_set_image_height_and_width_metadata_when_file_does_not_have_those_values() |
|
|
|
{ |
|
|
|
var command = Command("SampleAudio_0.4mb.mp3"); |
|
|
|
|
|
|
|
await sut.EnhanceAsync(command); |
|
|
|
|
|
|
|
Assert.Null(command.Metadata.GetPixelWidth()); |
|
|
|
Assert.Null(command.Metadata.GetPixelHeight()); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_provide_metadata_for_audio() |
|
|
|
{ |
|
|
|
|