Skip to content

Commit 1b08543

Browse files
Avoid import failure due to filenames with invalid 3 letter slot codes
1 parent dcbd2bd commit 1b08543

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

xivModdingFramework/Cache/XivDependencyGraph.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,12 @@ public static XivDependencyRootInfo ExtractRootInfo(string internalFilePath)
680680
match = _slotRegex.Match(internalFilePath);
681681
if (match.Success)
682682
{
683-
info.Slot = match.Groups[1].Value;
683+
// Validate the slot name to avoid matching on arbitrary three letter strings that may be present
684+
if (XivItemTypes.GetAvailableSlots(info.PrimaryType).Contains(match.Groups[1].Value)
685+
|| (info.SecondaryType.HasValue && XivItemTypes.GetAvailableSlots(info.SecondaryType.Value).Contains(match.Groups[1].Value)))
686+
{
687+
info.Slot = match.Groups[1].Value;
688+
}
684689
}
685690
}
686691
else

xivModdingFramework/Materials/DataContainers/XivMtrl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ public string GetMaterialIdentifier()
508508
public string GetItemTypeIdentifier()
509509
{
510510
// This regex feels a little janky, but it's good enough for now.
511-
var match = Regex.Match(MTRLPath, "_([a-z]{3})_[a-z0-9]\\.mtrl");
511+
var match = Regex.Match(MTRLPath, "_([a-z]{3})_[a-z0-9]+\\.mtrl");
512512
if (match.Success)
513513
{
514514
return "_" + match.Groups[1].Value;

0 commit comments

Comments
 (0)