mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Fix out-of-root path detection logic
This commit is contained in:
parent
ec09a7eb0e
commit
981c2bace4
1 changed files with 3 additions and 1 deletions
|
|
@ -25,6 +25,8 @@ public class ResourceTreeFactory(
|
|||
PathState pathState,
|
||||
ModManager modManager) : IService
|
||||
{
|
||||
private static readonly string ParentDirectoryPrefix = $"..{Path.DirectorySeparatorChar}";
|
||||
|
||||
private TreeBuildCache CreateTreeBuildCache()
|
||||
=> new(objects, gameData, actors);
|
||||
|
||||
|
|
@ -159,7 +161,7 @@ public class ResourceTreeFactory(
|
|||
if (onlyWithinPath != null)
|
||||
{
|
||||
var relPath = Path.GetRelativePath(onlyWithinPath, fullPath.FullName);
|
||||
if (relPath != "." && (relPath.StartsWith('.') || Path.IsPathRooted(relPath)))
|
||||
if (relPath == ".." || relPath.StartsWith(ParentDirectoryPrefix) || Path.IsPathRooted(relPath))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue