mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 04:34:18 +01:00
Use CultureInvariant string conversion for Guids
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Common.Progress;
|
||||
@@ -14,14 +15,14 @@ namespace MediaBrowser.Controller.Channels
|
||||
{
|
||||
if (user.Policy.BlockedChannels != null)
|
||||
{
|
||||
if (user.Policy.BlockedChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
|
||||
if (user.Policy.BlockedChannels.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
|
||||
if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -60,7 +61,7 @@ namespace MediaBrowser.Controller.Channels
|
||||
|
||||
public static string GetInternalMetadataPath(string basePath, Guid id)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "channels", id.ToString("N"), "metadata");
|
||||
return System.IO.Path.Combine(basePath, "channels", id.ToString("N", CultureInfo.InvariantCulture), "metadata");
|
||||
}
|
||||
|
||||
public override bool CanDelete()
|
||||
|
||||
@@ -503,7 +503,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
foreach (var folder in collectionFolders)
|
||||
{
|
||||
if (allowed.Contains(folder.Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
|
||||
if (allowed.Contains(folder.Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -664,10 +664,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "channels", ChannelId.ToString("N"), Id.ToString("N"));
|
||||
return System.IO.Path.Combine(basePath, "channels", ChannelId.ToString("N", CultureInfo.InvariantCulture), Id.ToString("N", CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
var idString = Id.ToString("N");
|
||||
var idString = Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
|
||||
basePath = System.IO.Path.Combine(basePath, "library");
|
||||
|
||||
@@ -1095,7 +1095,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var info = new MediaSourceInfo
|
||||
{
|
||||
Id = item.Id.ToString("N"),
|
||||
Id = item.Id.ToString("N", CultureInfo.InvariantCulture),
|
||||
Protocol = protocol ?? MediaProtocol.File,
|
||||
MediaStreams = MediaSourceManager.GetMediaStreams(item.Id),
|
||||
Name = GetMediaSourceName(item),
|
||||
@@ -1113,7 +1113,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (info.Protocol == MediaProtocol.File)
|
||||
{
|
||||
info.ETag = item.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N");
|
||||
info.ETag = item.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
var video = item as Video;
|
||||
@@ -1626,7 +1626,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public virtual string CreatePresentationUniqueKey()
|
||||
{
|
||||
return Id.ToString("N");
|
||||
return Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
@@ -2736,7 +2736,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var list = GetEtagValues(user);
|
||||
|
||||
return string.Join("|", list.ToArray()).GetMD5().ToString("N");
|
||||
return string.Join("|", list.ToArray()).GetMD5().ToString("N", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
protected virtual List<string> GetEtagValues(User user)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -177,7 +178,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
if (user.Policy.BlockedMediaFolders != null)
|
||||
{
|
||||
if (user.Policy.BlockedMediaFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase) ||
|
||||
if (user.Policy.BlockedMediaFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase) ||
|
||||
|
||||
// Backwards compatibility
|
||||
user.Policy.BlockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase))
|
||||
@@ -187,7 +188,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
|
||||
if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N", CultureInfo.InvariantCulture), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
@@ -29,7 +30,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (string.IsNullOrEmpty(child.Path))
|
||||
{
|
||||
child.LibraryItemId = item.Id.ToString("N");
|
||||
child.LibraryItemId = item.Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
return child;
|
||||
@@ -37,7 +38,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public LinkedChild()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString("N");
|
||||
Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -91,7 +92,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
}
|
||||
|
||||
var folders = LibraryManager.GetCollectionFolders(this)
|
||||
.Select(i => i.Id.ToString("N"))
|
||||
.Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture))
|
||||
.ToArray();
|
||||
|
||||
if (folders.Length == 0)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -230,7 +231,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
// TODO: Remove idPath and just use usernamePath for future releases
|
||||
var usernamePath = System.IO.Path.Combine(parentPath, username);
|
||||
var idPath = System.IO.Path.Combine(parentPath, Id.ToString("N"));
|
||||
var idPath = System.IO.Path.Combine(parentPath, Id.ToString("N", CultureInfo.InvariantCulture));
|
||||
if (!Directory.Exists(usernamePath) && Directory.Exists(idPath))
|
||||
{
|
||||
Directory.Move(idPath, usernamePath);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
@@ -987,7 +988,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
private UserView GetUserViewWithName(string name, string type, string sortName, BaseItem parent)
|
||||
{
|
||||
return _userViewManager.GetUserSubView(parent.Id, parent.Id.ToString("N"), type, sortName);
|
||||
return _userViewManager.GetUserSubView(parent.Id, parent.Id.ToString("N", CultureInfo.InvariantCulture), type, sortName);
|
||||
}
|
||||
|
||||
private UserView GetUserView(string type, string localizationKey, string sortName, BaseItem parent)
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
|
||||
var info = new MediaSourceInfo
|
||||
{
|
||||
Id = Id.ToString("N"),
|
||||
Id = Id.ToString("N", CultureInfo.InvariantCulture),
|
||||
Protocol = PathProtocol ?? MediaProtocol.File,
|
||||
MediaStreams = new List<MediaStream>(),
|
||||
Name = Name,
|
||||
@@ -111,7 +111,7 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
|
||||
protected override string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"), "metadata");
|
||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N", CultureInfo.InvariantCulture), "metadata");
|
||||
}
|
||||
|
||||
public override bool CanDelete()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
@@ -188,7 +189,7 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
|
||||
protected override string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
|
||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N", CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
public override bool CanDelete()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -239,7 +240,7 @@ namespace MediaBrowser.Controller.Playlists
|
||||
return base.IsVisible(user);
|
||||
}
|
||||
|
||||
var userId = user.Id.ToString("N");
|
||||
var userId = user.Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
foreach (var share in shares)
|
||||
{
|
||||
if (string.Equals(share.UserId, userId, StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
@@ -55,7 +56,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
foreach (var i in UserDataList)
|
||||
{
|
||||
if (string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(userId, i.UserId.ToString("N", CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
userData = i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user