mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-11-25 07:44:59 -05:00
Backport pull request #15466 from jellyfin/release-10.11.z
Don't error out when searching for marker files fails Original-merge: f4a846aa4dcffb3be7b701f806b24cb8dd6b7c5d Merged-by: crobibero <cody@robibe.ro> Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
parent
e51680cf56
commit
d7f628677e
@ -107,10 +107,20 @@ namespace Emby.Server.Implementations.AppBase
|
|||||||
|
|
||||||
private void CheckOrCreateMarker(string path, string markerName, bool recursive = false)
|
private void CheckOrCreateMarker(string path, string markerName, bool recursive = false)
|
||||||
{
|
{
|
||||||
var otherMarkers = GetMarkers(path, recursive).FirstOrDefault(e => Path.GetFileName(e) != markerName);
|
string? otherMarkers = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
otherMarkers = GetMarkers(path, recursive).FirstOrDefault(e => !Path.GetFileName(e.AsSpan()).Equals(markerName, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Error while checking for marker files, assume none exist and keep going
|
||||||
|
// TODO: add some logging
|
||||||
|
}
|
||||||
|
|
||||||
if (otherMarkers is not null)
|
if (otherMarkers is not null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"Exepected to find only {markerName} but found marker for {otherMarkers}.");
|
throw new InvalidOperationException($"Expected to find only {markerName} but found marker for {otherMarkers}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var markerPath = Path.Combine(path, markerName);
|
var markerPath = Path.Combine(path, markerName);
|
||||||
|
|||||||
@ -103,11 +103,11 @@ namespace MediaBrowser.Common.Configuration
|
|||||||
void MakeSanityCheckOrThrow();
|
void MakeSanityCheckOrThrow();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks and creates the given path and adds it with a marker file if non existant.
|
/// Checks and creates the given path and adds it with a marker file if non existent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path to check.</param>
|
/// <param name="path">The path to check.</param>
|
||||||
/// <param name="markerName">The common marker file name.</param>
|
/// <param name="markerName">The common marker file name.</param>
|
||||||
/// <param name="recursive">Check for other settings paths recursivly.</param>
|
/// <param name="recursive">Check for other settings paths recursively.</param>
|
||||||
void CreateAndCheckMarker(string path, string markerName, bool recursive = false);
|
void CreateAndCheckMarker(string path, string markerName, bool recursive = false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user