Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix freeze on non CKAN files in cache folder #2743

Merged
merged 1 commit into from
Apr 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Core/Net/NetFileCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class NetFileCache : IDisposable
private Dictionary<string, string> cachedFiles;
private string cachePath;
private KSPManager manager;
private static readonly Regex cacheFileRegex = new Regex("^[0-9A-F]{8}-", RegexOptions.Compiled);
private static readonly ILog log = LogManager.GetLogger(typeof (NetFileCache));

/// <summary>
Expand Down Expand Up @@ -377,7 +378,10 @@ private List<FileInfo> allFiles()
DirectoryInfo legDir = new DirectoryInfo(legacyDir);
files = files.Union(legDir.EnumerateFiles());
}
return files.ToList();
return files
// Require 8 digit hex prefix followed by dash; any else was not put there by CKAN
.Where(fi => cacheFileRegex.IsMatch(fi.Name))
.ToList();
}

/// <summary>
Expand Down