The Free Software Media System - Server Backend & API
Fix build
Bond_009cf7290343ff4
diff --git a/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs b/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.csindex 43f71a69c6..332ce39034 100644--- a/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs+++ b/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs@@ -1,17 +1,14 @@using System;using System.Collections.Generic;-using System.Globalization;using System.IO;using System.Net;using System.Linq;-using System.Text;using MediaBrowser.Common.Net;using Microsoft.AspNetCore.Http;using Microsoft.AspNetCore.Http.Extensions;using Microsoft.Extensions.Logging;using Microsoft.Extensions.Primitives;using Microsoft.Net.Http.Headers;-using IHttpFile = MediaBrowser.Model.Services.IHttpFile;using IHttpRequest = MediaBrowser.Model.Services.IHttpRequest;namespace Emby.Server.Implementations.SocketSharp@@ -25,8 +22,6 @@ namespace Emby.Server.Implementations.SocketSharpprivate string _remoteIp;private Dictionary<string, object> _items;private string _responseContentType;- private IHttpFile[] _httpFiles;- private Dictionary<string, HttpPostedFile> _files;public WebSocketSharpRequest(HttpRequest httpRequest, HttpResponse httpResponse, string operationName, ILogger logger){@@ -109,39 +104,6 @@ namespace Emby.Server.Implementations.SocketSharppublic long ContentLength => Request.ContentLength ?? 0;-- public IHttpFile[] Files- {- get- {- if (_httpFiles != null)- {- return _httpFiles;- }-- if (_files == null)- {- return _httpFiles = Array.Empty<IHttpFile>();- }-- var values = _files.Values;- _httpFiles = new IHttpFile[values.Count];- for (int i = 0; i < values.Count; i++)- {- var reqFile = values.ElementAt(i);- _httpFiles[i] = new HttpFile- {- ContentType = reqFile.ContentType,- ContentLength = reqFile.ContentLength,- FileName = reqFile.FileName,- InputStream = reqFile.InputStream,- };- }-- return _httpFiles;- }- }-private string GetHeader(string name) => Request.Headers[name].ToString();private static IPAddress NormalizeIp(IPAddress ip)diff --git a/MediaBrowser.Api/Devices/DeviceService.cs b/MediaBrowser.Api/Devices/DeviceService.csindex dc211af6b5..697a84f5c2 100644--- a/MediaBrowser.Api/Devices/DeviceService.cs+++ b/MediaBrowser.Api/Devices/DeviceService.cs@@ -133,12 +133,15 @@ namespace MediaBrowser.Api.Devicesvar album = Request.QueryString["Album"];var id = Request.QueryString["Id"];var name = Request.QueryString["Name"];+ var req = Request.Response.HttpContext.Request;- if (Request.ContentType.IndexOf("multi", StringComparison.OrdinalIgnoreCase) == -1)+ if (req.HasFormContentType){- return _deviceManager.AcceptCameraUpload(deviceId, request.RequestStream, new LocalFileInfo+ var file = req.Form.Files.Count == 0 ? null : req.Form.Files[0];++ return _deviceManager.AcceptCameraUpload(deviceId, file.OpenReadStream(), new LocalFileInfo{- MimeType = Request.ContentType,+ MimeType = file.ContentType,Album = album,Name = name,Id = id@@ -146,11 +149,9 @@ namespace MediaBrowser.Api.Devices}else{- var file = Request.Files.Length == 0 ? null : Request.Files[0];-- return _deviceManager.AcceptCameraUpload(deviceId, file.InputStream, new LocalFileInfo+ return _deviceManager.AcceptCameraUpload(deviceId, request.RequestStream, new LocalFileInfo{- MimeType = file.ContentType,+ MimeType = Request.ContentType,Album = album,Name = name,Id = iddiff --git a/MediaBrowser.Model/Services/IRequest.cs b/MediaBrowser.Model/Services/IRequest.csindex 3852b1dd74..7a41526986 100644--- a/MediaBrowser.Model/Services/IRequest.cs+++ b/MediaBrowser.Model/Services/IRequest.cs@@ -1,9 +1,6 @@using System;using System.Collections.Generic;using System.IO;-using System.Threading;-using System.Threading.Tasks;-using MediaBrowser.Model.IO;using Microsoft.AspNetCore.Http;namespace MediaBrowser.Model.Services@@ -67,11 +64,6 @@ namespace MediaBrowser.Model.Serviceslong ContentLength { get; }- /// <summary>- /// Access to the multi-part/formdata files posted on this request- /// </summary>- IHttpFile[] Files { get; }-/// <summary>/// The value of the Referrer, null if not available/// </summary>