Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for beatsaber 1.29.0 + download fixes #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix ArgumentException: Illegal characters in path.
kenx00x committed Apr 7, 2023
commit d27ee3af350f42837dcb18a568c86d675f303eba
3 changes: 3 additions & 0 deletions ModelDownloader/Utils/DownloadUtils.cs
Original file line number Diff line number Diff line change
@@ -66,6 +66,9 @@ public static async void DownloadModel(ModelsaberEntry model, string DownloadPat
byte[] fileBytes = await ModelsaberUtils.GetModelBytes(model);
string modelFileName = model.Download.Substring(model.Download.LastIndexOf("/") + 1);

// Remove illegal characters from the filename
modelFileName = new string(modelFileName.Where(c => !Path.GetInvalidFileNameChars().Contains(c)).ToArray());

Plugin.Log.Info("Checking hash...");
if (model.Hash.ToLower() == MD5Checksum(fileBytes).ToLower()) Plugin.Log.Info($"Hash check for {model.Name} passed!");
else