mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: NzbDrone running on Windows should no longer fail while getting a very long path from a sabnzbd running on linux.
This commit is contained in:
@@ -53,6 +53,22 @@ namespace NzbDrone.Common
|
||||
return childPath.Substring(parentPath.Length).Trim(Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
public static string GetParentPath(this string childPath)
|
||||
{
|
||||
var parentPath = childPath.TrimEnd('\\', '/');
|
||||
|
||||
var index = parentPath.LastIndexOfAny(new[] { '\\', '/' });
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
return parentPath.Substring(0, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsParentPath(this string parentPath, string childPath)
|
||||
{
|
||||
parentPath = parentPath.TrimEnd(Path.DirectorySeparatorChar);
|
||||
|
Reference in New Issue
Block a user