Skip to content

Commit 012440b

Browse files
dldl-cmdbaywet
andauthored
Apply suggestions from code review - directly index splited result as there will be always a result
Co-authored-by: Vincent Biret <[email protected]>
1 parent f59683a commit 012440b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Microsoft.OpenApi/Reader/V3/OpenApiV3Deserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private static (string, string) GetReferenceIdAndExternalResource(string pointer
196196
string externalResource = null;
197197
if (isExternalResource)
198198
{
199-
externalResource = pointer.Split('#').FirstOrDefault()?.TrimEnd('#');
199+
externalResource = pointer.Split('#')[0].TrimEnd('#');
200200
}
201201

202202
return (refId, externalResource);

src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private static (string, string) GetReferenceIdAndExternalResource(string pointer
165165
string externalResource = null;
166166
if (isExternalResource && pointer.Contains('#'))
167167
{
168-
externalResource = pointer.Split('#').FirstOrDefault()?.TrimEnd('#');
168+
externalResource = pointer.Split('#')[0].TrimEnd('#');
169169
}
170170

171171
return (refId, externalResource);

0 commit comments

Comments
 (0)