summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-06 00:37:10 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-06 00:37:10 -0400
commit29f909a8d5dbb83d6df1a54d2680e6f9898f3b19 (patch)
tree8abcd73e6acf6f8028712210877ae73f70ddbbc9 /src/SMAPI/Framework/ContentManagers/ModContentManager.cs
parenta20413664bcf073f88bb37bc225e6f0bf7756495 (diff)
downloadSMAPI-29f909a8d5dbb83d6df1a54d2680e6f9898f3b19.tar.gz
SMAPI-29f909a8d5dbb83d6df1a54d2680e6f9898f3b19.tar.bz2
SMAPI-29f909a8d5dbb83d6df1a54d2680e6f9898f3b19.zip
fix asset name truncation when loading XNB mod file without file extension
Diffstat (limited to 'src/SMAPI/Framework/ContentManagers/ModContentManager.cs')
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index b3de273a..63070d85 100644
--- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
+++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
@@ -219,7 +219,9 @@ namespace StardewModdingAPI.Framework.ContentManagers
{
// the underlying content manager adds a .xnb extension implicitly, so
// we need to strip it here to avoid trying to load a '.xnb.xnb' file.
- IAssetName loadName = this.Coordinator.ParseAssetName(assetName.Name[..^".xnb".Length], allowLocales: false);
+ IAssetName loadName = assetName.Name.EndsWith(".xnb", StringComparison.OrdinalIgnoreCase)
+ ? this.Coordinator.ParseAssetName(assetName.Name[..^".xnb".Length], allowLocales: false)
+ : assetName;
// load asset
T asset = this.RawLoad<T>(loadName, useCache: false);