fix web socket session creation

This commit is contained in:
Luke Pulverenti
2016-09-14 17:34:19 -04:00
parent 0c95297269
commit d95c0e8324
5 changed files with 49 additions and 15 deletions

View File

@@ -695,7 +695,7 @@ namespace MediaBrowser.Server.Implementations.Library
public IEnumerable<BaseItem> ResolvePaths(IEnumerable<FileSystemMetadata> files,
IDirectoryService directoryService,
Folder parent,
Folder parent,
LibraryOptions libraryOptions,
string collectionType,
IItemResolver[] resolvers)
@@ -1490,10 +1490,10 @@ namespace MediaBrowser.Server.Implementations.Library
private void AddUserToQuery(InternalItemsQuery query, User user)
{
if (query.AncestorIds.Length == 0 &&
!query.ParentId.HasValue &&
query.ChannelIds.Length == 0 &&
query.TopParentIds.Length == 0 &&
if (query.AncestorIds.Length == 0 &&
!query.ParentId.HasValue &&
query.ChannelIds.Length == 0 &&
query.TopParentIds.Length == 0 &&
string.IsNullOrWhiteSpace(query.AncestorWithPresentationUniqueKey)
&& query.ItemIds.Length == 0)
{
@@ -2552,7 +2552,7 @@ namespace MediaBrowser.Server.Implementations.Library
throw new ArgumentNullException("to");
}
var newPath = path.Replace(from, to, StringComparison.OrdinalIgnoreCase);
var newPath = path.Replace(from.Trim(), to.Trim(), StringComparison.OrdinalIgnoreCase);
if (!string.Equals(newPath, path))
{

View File

@@ -1341,8 +1341,19 @@ namespace MediaBrowser.Server.Implementations.Session
private async Task<AuthenticationResult> AuthenticateNewSessionInternal(AuthenticationRequest request, bool enforcePassword)
{
var user = _userManager.Users
.FirstOrDefault(i => string.Equals(request.Username, i.Name, StringComparison.OrdinalIgnoreCase));
User user = null;
if (!string.IsNullOrWhiteSpace(request.UserId))
{
var idGuid = new Guid(request.UserId);
user = _userManager.Users
.FirstOrDefault(i => i.Id == idGuid);
}
if (user == null)
{
user = _userManager.Users
.FirstOrDefault(i => string.Equals(request.Username, i.Name, StringComparison.OrdinalIgnoreCase));
}
if (user != null && !string.IsNullOrWhiteSpace(request.DeviceId))
{