fix this case.

This commit is contained in:
atravita-mods 2022-10-18 18:58:41 -04:00
parent 4dcc6904b9
commit b99dbf53bd
2 changed files with 6 additions and 0 deletions

View File

@ -245,6 +245,8 @@ namespace SMAPI.Tests.Core
[TestCase("Mods/SomeMod/SomeSubdirectory", "Mods/Some", true, ExpectedResult = true)]
[TestCase("Mods/SomeMod/SomeSubdirectory", "Mods/Some", false, ExpectedResult = false)]
[TestCase("Mods/Jasper/Data", "Mods/Jas/Image", true, ExpectedResult = false)]
[TestCase("Mods/Jasper/Data", "Mods/Jas/Image", true, ExpectedResult = false)]
public bool StartsWith_SubfolderWithPartial(string mainAssetName, string otherAssetName, bool allowSubfolder)
{
// arrange

View File

@ -179,6 +179,10 @@ namespace StardewModdingAPI.Framework.Content
}
else
{
// mismatch: prefix has more beyond this, and this segment isn't an exact match
if (prefixParts.Remainder.Length != 0)
return false;
// mismatch: cur segment doesn't start with prefix
if (!curParts.Current.StartsWith(prefixParts.Current, StringComparison.OrdinalIgnoreCase))
return false;