From 4fce741b53a6a90a92c5f013c640607eb5a07f68 Mon Sep 17 00:00:00 2001 From: Noethix55555 <277300782+Noethix55555@users.noreply.github.com> Date: Wed, 17 Jun 2026 22:52:02 -0400 Subject: [PATCH] fix: only strip inline # comment when preceded by whitespace in mpv.conf parser --- src/MpvNet/Player.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MpvNet/Player.cs b/src/MpvNet/Player.cs index 25310545..d1849a59 100644 --- a/src/MpvNet/Player.cs +++ b/src/MpvNet/Player.cs @@ -301,10 +301,12 @@ public Dictionary Conf { string key = line[..line.IndexOf("=")].Trim(); string value = line[(line.IndexOf("=") + 1)..].Trim(); - if (value.Contains('#') && !value.StartsWith("#") && + int hashIndex = value.IndexOf(" #"); + + if (hashIndex >= 0 && !value.StartsWith("#") && !value.StartsWith("'#") && !value.StartsWith("\"#")) - value = value[..value.IndexOf("#")].Trim(); + value = value[..hashIndex].Trim(); _Conf[key] = value; }