Merge pull request #485 from chlupac/FileController

File Controller bug
This commit is contained in:
Shaun Walker 2020-05-15 07:28:12 -04:00 committed by GitHub
commit 24ca9f4ded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -413,8 +413,11 @@ namespace Oqtane.Controllers
{ {
_logger.Log(LogLevel.Error, this, LogFunction.Read, "File Does Not Exist {FileId} {FilePath}", id, filepath); _logger.Log(LogLevel.Error, this, LogFunction.Read, "File Does Not Exist {FileId} {FilePath}", id, filepath);
HttpContext.Response.StatusCode = 404; HttpContext.Response.StatusCode = 404;
byte[] filebytes = System.IO.File.ReadAllBytes(errorpath); if (System.IO.File.Exists(errorpath))
return File(filebytes, "application/octet-stream", file.Name); {
byte[] filebytes = System.IO.File.ReadAllBytes(errorpath);
return File(filebytes, "application/octet-stream", file.Name);
}
} }
} }
else else
@ -432,6 +435,7 @@ namespace Oqtane.Controllers
byte[] filebytes = System.IO.File.ReadAllBytes(errorpath); byte[] filebytes = System.IO.File.ReadAllBytes(errorpath);
return File(filebytes, "application/octet-stream", "error.png"); return File(filebytes, "application/octet-stream", "error.png");
} }
return null;
} }
private string GetFolderPath(Folder folder) private string GetFolderPath(Folder folder)