diff --git a/BeatSaberHTTPStatus/Plugin.cs b/BeatSaberHTTPStatus/Plugin.cs index 85239a9..613ba38 100644 --- a/BeatSaberHTTPStatus/Plugin.cs +++ b/BeatSaberHTTPStatus/Plugin.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Text.RegularExpressions; using System.Threading; using UnityEngine; using UnityEngine.SceneManagement; @@ -343,7 +344,7 @@ public async void HandleSongStart() { gameStatus.songBPM = level.beatsPerMinute; gameStatus.noteJumpSpeed = diff.noteJumpMovementSpeed; // 13 is "custom_level_" and 40 is the magic number for the length of the SHA-1 hash - gameStatus.songHash = level.levelID.StartsWith("custom_level_") && !level.levelID.EndsWith(" WIP") ? level.levelID.Substring(13, 40) : null; + gameStatus.songHash = Regex.IsMatch(level.levelID, "^custom_level_[0-9A-F]{40}", RegexOptions.IgnoreCase) && !level.levelID.EndsWith(" WIP") ? level.levelID.Substring(13, 40) : null; gameStatus.levelId = level.levelID; gameStatus.songTimeOffset = (long) (level.songTimeOffset * 1000f / songSpeedMul); gameStatus.length = (long) (level.beatmapLevelData.audioClip.length * 1000f / songSpeedMul);