Skip to content

Commit

Permalink
Merge pull request #19 from bb-io/develop
Browse files Browse the repository at this point in the history
Added check the validity of the XLIFF file
  • Loading branch information
RiabushenkoA authored Feb 6, 2025
2 parents 4321a36 + 2fd9755 commit 6401ab4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion Apps.Widn/Actions/QualityActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,15 @@ private List<TranslationUnit> ExtractSegmentsFromXliff(Stream inputStream)

using (var reader = new StreamReader(inputStream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, leaveOpen: true))
{
var xliffDocument = XDocument.Load(reader);
XDocument xliffDocument;
try
{
xliffDocument = XDocument.Load(reader);
}
catch (Exception ex)
{
throw new PluginMisconfigurationException("Failed to proceed the input file. Please ensure that the file is a valid XLIFF file.");
}

XNamespace ns = xliffDocument.Root.GetDefaultNamespace();

Expand Down
2 changes: 1 addition & 1 deletion Apps.Widn/Apps.Widn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<Product>Widn</Product>
<Description>Accurate translations, preserving meaning and nuance across +20 language pairs and various domains.</Description>
<Version>1.0.14</Version>
<Version>1.0.15</Version>
<AssemblyName>Apps.Widn</AssemblyName>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Tests.Widn/TranslateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task EvaluateQuality_ReturnsValues()
};
var input2 = new QualityEvaluateRequest
{
ReferenceText = "Hi"
ReferenceText = "Hello"
};
var result = await action.EvaluateQuality(input1, input2);
Assert.IsNotNull(result);
Expand Down

0 comments on commit 6401ab4

Please sign in to comment.