Backport pull request #9178 from jellyfin/release-10.8.z

Escape the path to pass as a command line argument

Original-merge: 09f1c7f535

Merged-by: Dmitry Lyzo <56478732+dmitrylyzo@users.noreply.github.com>

Backported-by: crobibero <cody@robibe.ro>
This commit is contained in:
Róbert Örn Ketilsson 2023-03-09 19:29:39 -05:00 committed by crobibero
parent 6b0135d03b
commit ef3868ff50
4 changed files with 9 additions and 5 deletions

View File

@ -19,6 +19,8 @@ using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Net;
using MediaBrowser.MediaEncoding.Encoder;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
@ -1654,8 +1656,8 @@ public class DynamicHlsController : BaseJellyfinApiController
startNumber.ToString(CultureInfo.InvariantCulture), startNumber.ToString(CultureInfo.InvariantCulture),
baseUrlParam, baseUrlParam,
isEventPlaylist ? "event" : "vod", isEventPlaylist ? "event" : "vod",
outputTsArg, EncodingUtils.NormalizePath(outputTsArg),
outputPath).Trim(); EncodingUtils.NormalizePath(outputPath)).Trim();
} }
/// <summary> /// <summary>

View File

@ -22,6 +22,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Emby.Dlna\Emby.Dlna.csproj" /> <ProjectReference Include="..\Emby.Dlna\Emby.Dlna.csproj" />
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" /> <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
<ProjectReference Include="..\MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj" />
<ProjectReference Include="..\src\Jellyfin.MediaEncoding.Hls\Jellyfin.MediaEncoding.Hls.csproj" /> <ProjectReference Include="..\src\Jellyfin.MediaEncoding.Hls\Jellyfin.MediaEncoding.Hls.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -14,6 +14,7 @@ using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.MediaEncoding.Encoder;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
@ -301,10 +302,10 @@ namespace MediaBrowser.MediaEncoding.Attachments
var processArgs = string.Format( var processArgs = string.Format(
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
"-dump_attachment:{1} {2} -i {0} -t 0 -f null null", "-dump_attachment:{1} \"{2}\" -i {0} -t 0 -f null null",
inputPath, inputPath,
attachmentStreamIndex, attachmentStreamIndex,
outputPath); EncodingUtils.NormalizePath(outputPath));
int exitCode; int exitCode;

View File

@ -56,7 +56,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
/// </summary> /// </summary>
/// <param name="path">The path.</param> /// <param name="path">The path.</param>
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
private static string NormalizePath(string path) public static string NormalizePath(string path)
{ {
// Quotes are valid path characters in linux and they need to be escaped here with a leading \ // Quotes are valid path characters in linux and they need to be escaped here with a leading \
return path.Replace("\"", "\\\"", StringComparison.Ordinal); return path.Replace("\"", "\\\"", StringComparison.Ordinal);