avatars: Fix #1576

This commit is contained in:
Hylke Bons 2014-11-11 18:07:19 +00:00
parent 106fbef51b
commit baececd569

View file

@ -46,11 +46,13 @@ namespace SparkleShare
// Search avatars by file name, ignore extension
// Delete files over a day old
// Return first matching file
foreach (string file_path in Directory.GetFiles (avatars_path, email.MD5 () + "*")) {
if (new FileInfo (file_path).LastWriteTime < DateTime.Now.AddDays (-1))
File.Delete (file_path);
else
return file_path;
if (Directory.Exists (avatars_path)) {
foreach (string file_path in Directory.GetFiles (avatars_path, email.MD5 () + "*")) {
if (new FileInfo (file_path).CreationTime < DateTime.Now.AddDays (-1))
File.Delete (file_path);
else
return file_path;
}
}
string avatar_file_path;