1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Added error handling to paste/upload deletions

This commit is contained in:
Uncled1023 2020-06-16 23:49:52 -07:00
parent 8954102306
commit 22f2a1ae00
2 changed files with 16 additions and 2 deletions

View File

@ -427,7 +427,14 @@ namespace Teknik.Areas.Paste.Controllers
// Delete the File // Delete the File
if (System.IO.File.Exists(delPath)) if (System.IO.File.Exists(delPath))
{ {
System.IO.File.Delete(delPath); try
{
System.IO.File.Delete(delPath);
}
catch (Exception ex)
{
_logger.LogError(ex, "Unable to delete file: {0}", paste.FileName);
}
} }
} }

View File

@ -561,7 +561,14 @@ namespace Teknik.Areas.Upload.Controllers
// Delete the File // Delete the File
if (System.IO.File.Exists(filePath)) if (System.IO.File.Exists(filePath))
{ {
System.IO.File.Delete(filePath); try
{
System.IO.File.Delete(filePath);
}
catch (Exception ex)
{
_logger.LogError(ex, "Unable to delete file: {0}", upload.FileName);
}
} }
// Delete from the DB // Delete from the DB