Aufgrund einer Wartung wird GitLab am 29.10. zwischen 9:00 und 10:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 29.10. between 9:00 and 10:00 am.

...
 
Commits (3)
......@@ -9,8 +9,8 @@ using System.Reflection;
[assembly: AssemblyDescription("Project.Tests is a part of the CoScInE group.")]
[assembly: AssemblyCompany("IT Center, RWTH Aachen University")]
[assembly: AssemblyProduct("Project.Tests")]
[assembly: AssemblyVersion("1.13.0.0")]
[assembly: AssemblyFileVersion("1.13.0.0")]
[assembly: AssemblyInformationalVersion("1.13.0.0")]
[assembly: AssemblyVersion("1.13.1.0")]
[assembly: AssemblyFileVersion("1.13.1.0")]
[assembly: AssemblyInformationalVersion("1.13.1.0")]
[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]
......@@ -112,7 +112,8 @@ namespace Coscine.Api.Project.Controllers
if (_resourceModel.HasAccess(user, resource, UserRoles.Owner, UserRoles.Member))
{
var id = _metadataModel.GenerateId(resourceId, filename, version);
var graph = _util.GetGraph(id);
var uri = _metadataModel.CreateUri(id);
var graph = _util.GetGraph(uri);
return Json(JToken.Parse(VDS.RDF.Writing.StringWriter.Write(graph, new RdfJsonWriter())).ToString());
}
else
......@@ -126,7 +127,7 @@ namespace Coscine.Api.Project.Controllers
{
var innerBlock = ObjectFactory<JToken>.DeserializeFromStream(Request.Body);
var graphName = _metadataModel.GenerateId(resourceId, filename, version);
var graphNameUri = new Uri(graphName);
var graphNameUri = _metadataModel.CreateUri(graphName);
var json = new JObject
{
[graphName] = innerBlock
......
......@@ -5,6 +5,7 @@ using LinqToDB;
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Web;
namespace Coscine.Api.Project.Models
{
......@@ -50,7 +51,15 @@ namespace Coscine.Api.Project.Models
public string GenerateId(string resourceId, string filename, string version)
{
return $"https://purl.org/coscine/md/{resourceId}/{filename}/{version}/";
// Double UrlEncode since converting it to Uri executes one UrlDecode and Virtuoso
// graph names don't support special characters
var encodedFileName = HttpUtility.UrlEncode(HttpUtility.UrlEncode(filename));
return $"https://purl.org/coscine/md/{resourceId}/{encodedFileName}/{version}/";
}
public Uri CreateUri(string graphName)
{
return new Uri(graphName);
}
}
}
......@@ -9,8 +9,8 @@ using System.Reflection;
[assembly: AssemblyDescription("Project is a part of the CoScInE group.")]
[assembly: AssemblyCompany("IT Center, RWTH Aachen University")]
[assembly: AssemblyProduct("Project")]
[assembly: AssemblyVersion("1.13.0.0")]
[assembly: AssemblyFileVersion("1.13.0.0")]
[assembly: AssemblyInformationalVersion("1.13.0.0")]
[assembly: AssemblyVersion("1.13.1.0")]
[assembly: AssemblyFileVersion("1.13.1.0")]
[assembly: AssemblyInformationalVersion("1.13.1.0")]
[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]