Skip to content
Snippets Groups Projects
Select Git revision
  • 133f06d9e8d78623c7f07d028aa0bf60cc2a6880
  • master default protected
  • gitkeep
  • dev protected
  • Issue/2464-invalidateMeta
  • Issue/2309-docs
  • Issue/2462-removeTraces
  • Hotfix/2459-EncodingPath
  • Hotfix/2452-linkedDeletion
  • Issue/1792-newMetadataStructure
  • Hotfix/2371-fixGitLabinRCV
  • Fix/xxxx-activateGitlab
  • Issue/2349-gitlabHttps
  • Issue/2287-guestRole
  • Issue/2102-gitLabResTypeRCV
  • Hotfix/2254-fixContentLenghtCalculation
  • Fix/xxxx-resourceVisibility
  • Issue/1951-quotaImplementation
  • Issue/2162-fixFolderResponse
  • Issue/2158-emailServicedesk
  • Hotfix/2141-fileUploadErrors
  • v3.3.4
  • v3.3.3
  • v3.3.2
  • v3.3.1
  • v3.3.0
  • v3.2.3
  • v3.2.2
  • v3.2.1
  • v3.2.0
  • v3.1.2
  • v3.1.1
  • v3.1.0
  • v3.0.6
  • v3.0.5
  • v3.0.4
  • v3.0.3
  • v3.0.2
  • v3.0.1
  • v3.0.0
  • v2.8.2
41 results

BlobController.cs

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    TreeController.cs 13.34 KiB
    using Coscine.WaterbutlerHelper;
    using Coscine.WaterbutlerHelper.ReturnObjects;
    using Coscine.WaterbutlerHelper.Services;
    using Coscine.ApiCommons;
    using Coscine.ApiCommons.Factories;
    using Coscine.Database.DataModel;
    using Coscine.Database.Models;
    using Coscine.Database.Util;
    using Coscine.Logging;
    using Coscine.Metadata;
    using Microsoft.AspNetCore.Authorization;
    using Microsoft.AspNetCore.Mvc;
    using Microsoft.Extensions.Logging;
    using Newtonsoft.Json.Linq;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.RegularExpressions;
    using System.Threading.Tasks;
    using System.Web;
    using VDS.RDF;
    using VDS.RDF.Parsing;
    using VDS.RDF.Writing;
    
    namespace Coscine.Api.Tree.Controllers
    {
        [Authorize]
        public class TreeController : Controller
        {
            private readonly Authenticator _authenticator;
            private readonly ResourceModel _resourceModel;
            private readonly RdfStoreConnector _rdfStoreConnector;
            private readonly ProjectRoleModel _projectRoleModel;
            private readonly ProjectResourceModel _projectResourceModel;
            private readonly CoscineLogger _coscineLogger;
            private readonly AnalyticsLogObject _analyticsLogObject;
            private readonly IDataSourceService _dataSourceService;
            private readonly WaterbutlerInterface _waterbutlerInterface;
            private readonly string _blobApiLink;
            private readonly string _prefix;
    
            public TreeController(ILogger<TreeController> logger, IDataSourceService dataSourceService)
            {
                _authenticator = new Authenticator(this, Program.Configuration);
                _resourceModel = new ResourceModel();
                _rdfStoreConnector = new RdfStoreConnector(Program.Configuration.GetStringAndWait("coscine/local/virtuoso/additional/url"));
                _projectRoleModel = new ProjectRoleModel();
                _projectResourceModel = new ProjectResourceModel();
    
                _coscineLogger = new CoscineLogger(logger);
                _analyticsLogObject = new AnalyticsLogObject();
                _dataSourceService = dataSourceService;
                _waterbutlerInterface = new WaterbutlerInterface(Program.Configuration, _dataSourceService);
    
                var rule = Program.Configuration.GetStringAndWait("traefik/frontends/Coscine.Api.Blob/routes/Coscine.Api.Blob/rule");
                var host = rule.Substring("Host:".Length, rule.IndexOf(";") - "Host:".Length);
                var path = rule.Substring(rule.IndexOf("/"));
                _blobApiLink = $"https://{host}{path}/blob/";
                _prefix = Program.Configuration.GetStringAndWait("coscine/global/epic/prefix");
            }
    
            public Uri GenerateId(string resourceId, string path)
            {
                return new Uri($"https://hdl.handle.net/{_prefix}/{resourceId}@path={Uri.EscapeDataString(path)}");
            }
    
            [HttpGet("[controller]/{resourceId}/{*path}")]
            public async Task<IActionResult> GetMetadata(string resourceId, string path)
            {
                path = $"/{path}";