Skip to content
Snippets Groups Projects
Commit 38ad362e authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

Merge branch 'Topic/1527-exposingUrls' into 'product/1472-exposingUrls'

Topic/1527 exposing urls

See merge request !29
parents 527b04f7 5e68ce3e
No related branches found
No related tags found
3 merge requests!32Product/1472 exposing urls,!31Sprint/2021 09,!29Topic/1527 exposing urls
......@@ -22,6 +22,7 @@ using VDS.RDF.Parsing;
using VDS.RDF.Writing;
using Coscine.ResourceLoader;
using Coscine.Configuration;
using Coscine.ResourceTypeBase;
namespace Coscine.Api.Tree.Controllers
{
......@@ -84,6 +85,7 @@ namespace Coscine.Api.Tree.Controllers
[HttpGet("[controller]/{resourceId}/{*path}")]
public async Task<IActionResult> GetMetadata(string resourceId, string path)
{
var rawPath = path;
path = $"/{path}";
if (path.Contains("%2F") || path.Contains("%2f"))
{
......@@ -144,6 +146,8 @@ namespace Coscine.Api.Tree.Controllers
Kind = x.Key[(x.Key.LastIndexOf(".") + 1)..],
Provider = resource.Type.DisplayName
};
var resourceTypeOptions = _resourceModel.GetResourceTypeOptions(resource.Id);
var resourceTypeDefinition = ResourceTypeFactory.CreateResourceTypeObject(resource.Type.DisplayName, _configuration);
var objectMetaInfoReturnObject = new ObjectMetaInfoReturnObject(objectMetaInfo, _blobApiLink, resource.Id.ToString());
var result = new JObject
{
......@@ -164,12 +168,12 @@ namespace Coscine.Api.Tree.Controllers
["Download"] = new JObject
{
["Method"] = "GET",
["Url"] = objectMetaInfoReturnObject.DownloadLink
["Url"] = resourceTypeDefinition?.GetEntryDownloadUrl(rawPath, null, resourceTypeOptions).Result.ToString()
},
["Upload"] = new JObject
{
["Method"] = "PUT",
["Url"] = objectMetaInfoReturnObject.UploadLink
["Url"] = resourceTypeDefinition?.GetEntryStoreUrl(rawPath, null, resourceTypeOptions).Result.ToString()
}
}
};
......@@ -320,6 +324,7 @@ namespace Coscine.Api.Tree.Controllers
return NoContent();
}
/// <summary>
/// Checks the resource Id and the path
/// </summary>
......
......@@ -5,7 +5,7 @@
<AssemblyName>Coscine.Api.Tree</AssemblyName>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFramework>net5.0</TargetFramework>
<Version>2.1.0</Version>
<Version>2.1.1</Version>
</PropertyGroup>
<PropertyGroup>
<Authors>RWTH Aachen University</Authors>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment