fixes the route to file posting
This commit is contained in:
parent
8142b9c892
commit
82dac46faf
1 changed files with 7 additions and 4 deletions
|
|
@ -42,7 +42,7 @@ namespace Yavsc.ApiControllers
|
||||||
return GetDir(null);
|
return GetDir(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{subdir}")]
|
[HttpGet("{*subdir}")]
|
||||||
public IActionResult GetDir(string subdir="")
|
public IActionResult GetDir(string subdir="")
|
||||||
{
|
{
|
||||||
if (subdir !=null)
|
if (subdir !=null)
|
||||||
|
|
@ -52,7 +52,7 @@ namespace Yavsc.ApiControllers
|
||||||
return Ok(files);
|
return Ok(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("{subdir}")]
|
[HttpPost("{*subdir}")]
|
||||||
public IActionResult Post(string subdir="")
|
public IActionResult Post(string subdir="")
|
||||||
{
|
{
|
||||||
string destDir = null;
|
string destDir = null;
|
||||||
|
|
@ -63,9 +63,12 @@ namespace Yavsc.ApiControllers
|
||||||
} catch (InvalidPathException ex) {
|
} catch (InvalidPathException ex) {
|
||||||
pathex = ex;
|
pathex = ex;
|
||||||
}
|
}
|
||||||
|
if (pathex!=null) {
|
||||||
|
logger.LogError($"invalid sub path: '{subdir}'.");
|
||||||
|
return HttpBadRequest(pathex);
|
||||||
|
}
|
||||||
logger.LogInformation($"Recieving files, saved in '{destDir}' (specified ad '{subdir}').");
|
logger.LogInformation($"Recieving files, saved in '{destDir}' (specified ad '{subdir}').");
|
||||||
if (pathex!=null)
|
|
||||||
return new BadRequestObjectResult(pathex);
|
|
||||||
var uid = User.GetUserId();
|
var uid = User.GetUserId();
|
||||||
var user = dbContext.Users.Single(
|
var user = dbContext.Users.Single(
|
||||||
u => u.Id == uid
|
u => u.Id == uid
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue