Skip to content

Commit

Permalink
Try Escaping Some Characters for MediaInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Aug 26, 2021
1 parent 1964d2d commit 62abe4e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Shoko.Server/Utilities/MediaInfoLib/MediaInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public static MediaContainer GetMediaInfo_New(string filename)
try
{
string exe = GetMediaInfoPathForOS();
string args = $"--OUTPUT=JSON \"{filename}\"";
var escapedName = filename.Replace("\"", "\\\"").Replace("`", "\\`").Replace("$", "\\$");
string args = $"--OUTPUT=JSON \"{escapedName}\"";

var pProcess = GetProcess(exe, args);
pProcess.Start();
Expand All @@ -41,7 +42,7 @@ public static MediaContainer GetMediaInfo_New(string filename)
if (string.IsNullOrWhiteSpace(output) || output.EqualsInvariantIgnoreCase("null"))
output = "No message";

logger.Error($"MediaInfo threw an error on {filename}: {output}");
logger.Error($"MediaInfo threw an error on {filename}, {exe} {args}: {output}");
return null;
}

Expand Down

0 comments on commit 62abe4e

Please sign in to comment.