Fix an route permission error by adding a try catch estructure to the GetFileContentById endpoint

main
Felix Morales 4 months ago
parent b68cffe741
commit eac74a4b62
  1. 25
      CORRESPONSALBackend.sln
  2. 4
      Controllers/Utils/MFileManagerController.cs

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CORRESPONSALBackend", "CORRESPONSALBackend.csproj", "{5FEAD431-682F-483D-8B56-E2F066C67B9D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5FEAD431-682F-483D-8B56-E2F066C67B9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FEAD431-682F-483D-8B56-E2F066C67B9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FEAD431-682F-483D-8B56-E2F066C67B9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FEAD431-682F-483D-8B56-E2F066C67B9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3F707F07-2501-48B3-A5A3-AE1EF8C6847B}
EndGlobalSection
EndGlobal

@ -39,9 +39,13 @@ namespace CORRESPONSALBackend.Controllers.Utils
[Route("GetFileContentById")] [Route("GetFileContentById")]
public async Task<IActionResult> GetFileContentById(long id, int Proceso) public async Task<IActionResult> GetFileContentById(long id, int Proceso)
{ {
try{
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso); FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso);
SvcMFileManager FM = new SvcMFileManager(_config, _Repo, RootPath + RelativePath.Path); SvcMFileManager FM = new SvcMFileManager(_config, _Repo, RootPath + RelativePath.Path);
return await FM.getFileContentById(id); return await FM.getFileContentById(id);
}catch(Exception ex){
return BadRequest(ex.Message);
}
} }

Loading…
Cancel
Save