mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-09 23:34:06 +02:00
Symlinks/junctions in plugin folders can go to hell
This commit is contained in:
parent
cb877b8b23
commit
fd523e552c
@ -84,14 +84,20 @@ public string GetFullPathIfSafe(PluginFolder folder, string relativePath){
|
||||
|
||||
try{
|
||||
string folderPathName = new DirectoryInfo(rootFolder).FullName;
|
||||
DirectoryInfo currentInfo = new DirectoryInfo(fullPath);
|
||||
DirectoryInfo currentInfo = new DirectoryInfo(fullPath); // initially points to the file, which is convenient for the Attributes check below
|
||||
DirectoryInfo parentInfo = currentInfo.Parent;
|
||||
|
||||
while(currentInfo.Parent != null){
|
||||
if (currentInfo.Parent.FullName == folderPathName){
|
||||
while(parentInfo != null){
|
||||
if (currentInfo.Attributes.HasFlag(FileAttributes.ReparsePoint)){ // no reason why a plugin should have files/folders with symlinks, junctions, or any other crap
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (parentInfo.FullName == folderPathName){
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
currentInfo = currentInfo.Parent;
|
||||
|
||||
currentInfo = parentInfo;
|
||||
parentInfo = currentInfo.Parent;
|
||||
}
|
||||
}
|
||||
catch{
|
||||
|
Loading…
Reference in New Issue
Block a user