Browse Source

Added error handling to paste/upload deletions

master
Teknikode 3 months ago
parent
commit
22f2a1ae00

+ 8
- 1
Teknik/Areas/Paste/Controllers/PasteController.cs View File

@@ -427,7 +427,14 @@ namespace Teknik.Areas.Paste.Controllers
// Delete the File
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);
}
}
}


+ 8
- 1
Teknik/Areas/Upload/Controllers/UploadController.cs View File

@@ -561,7 +561,14 @@ namespace Teknik.Areas.Upload.Controllers
// Delete the File
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

Loading…
Cancel
Save