Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • coscine/backend/apis/project
1 result
Select Git revision
Loading items
Show changes
Commits on Source (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")]