Skip to content

Commit e7d3ae8

Browse files
committed
Minor bugfix for enum parsing
1 parent 017d2cb commit e7d3ae8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Source/Common/Constants.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ namespace Schema.NET
66
public static class Constants
77
{
88
/// <summary>
9-
/// The HTTPS URL for Schema.org
9+
/// The HTTPS URL for Schema.org, excluding trailing slash.
1010
/// </summary>
1111
public const string HttpsSchemaOrgUrl = "https://schema.org";
1212

1313
/// <summary>
14-
/// The HTTPS URL for Schema.org
14+
/// The HTTP URL for Schema.org, excluding trailing slash.
1515
/// </summary>
1616
public const string HttpSchemaOrgUrl = "http://schema.org";
1717
}

Source/Common/EnumHelper.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ public static bool TryParseEnumFromSchemaUri(
6464
if (value is not null && value.StartsWith(Constants.HttpSchemaOrgUrl, StringComparison.OrdinalIgnoreCase))
6565
{
6666
#pragma warning disable IDE0057 // Use range operator. Need to multi-target.
67-
enumString = value.Substring(Constants.HttpSchemaOrgUrl.Length);
67+
enumString = value.Substring(Constants.HttpSchemaOrgUrl.Length + 1);
6868
#pragma warning restore IDE0057 // Use range operator. Need to multi-target.
6969
}
7070
else if (value is not null && value.StartsWith(Constants.HttpsSchemaOrgUrl, StringComparison.OrdinalIgnoreCase))
7171
{
7272
#pragma warning disable IDE0057 // Use range operator. Need to multi-target.
73-
enumString = value.Substring(Constants.HttpsSchemaOrgUrl.Length);
73+
enumString = value.Substring(Constants.HttpsSchemaOrgUrl.Length + 1);
7474
#pragma warning restore IDE0057 // Use range operator. Need to multi-target.
7575
}
7676
else

0 commit comments

Comments
 (0)