Skip to content
Snippets Groups Projects
Commit 1891e076 authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Unescape PID Uri

parent dd16e184
No related tags found
1 merge request!37Update: Overhaul PID handling
......@@ -56,7 +56,7 @@ namespace Coscine.Api.Pid.Controllers
[HttpGet("[controller]/valid/{pid}")]
public IActionResult IsValid(string pid)
{
var id = pid;
var id = Uri.UnescapeDataString(pid);
if (id.Contains('/'))
{
id = id[(id.IndexOf("/") + 1)..];
......@@ -73,8 +73,25 @@ namespace Coscine.Api.Pid.Controllers
{
id = id[..id.IndexOf("/")];
}
var resource = _resourceModel.GetByIdIncludingDeleted(new Guid(id));
var project = _projectModel.GetByIdIncludingDeleted(new Guid(id));
Resource resource = null;
try
{
resource = _resourceModel.GetByIdIncludingDeleted(new Guid(id));
}
catch
{
}
Project project = null;
try
{
project = _projectModel.GetByIdIncludingDeleted(new Guid(id));
}
catch
{
}
if (resource == null && project == null)
{
......@@ -97,8 +114,24 @@ namespace Coscine.Api.Pid.Controllers
[HttpPost("[controller]/sendMailToOwner")]
public IActionResult SendMailToOwner([FromBody] MessageObject messageObject)
{
var resource = _resourceModel.GetByIdIncludingDeleted(new Guid(messageObject.Guid));
var project = _projectModel.GetByIdIncludingDeleted(new Guid(messageObject.Guid));
Resource resource = null;
try
{
resource = _resourceModel.GetByIdIncludingDeleted(new Guid(messageObject.Guid));
}
catch
{
}
Project project = null;
try
{
project = _projectModel.GetByIdIncludingDeleted(new Guid(messageObject.Guid));
}
catch
{
}
if (resource == null && project == null)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment