Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BlobApi
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
apis
BlobApi
Merge requests
!86
Release: Sprint/2023 04
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Release: Sprint/2023 04
dev
into
master
Overview
0
Commits
2
Pipelines
1
Changes
3
Merged
Release: Sprint/2023 04 🤖
Petar Hristov
requested to merge
dev
into
master
Feb 24, 2023
Overview
0
Commits
2
Pipelines
1
Changes
3
This Merge Request is automatically created
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
d1bc7ffe
2 commits,
Feb 24, 2023
3 files
+
7
−
42
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
src/Blob/Controllers/BlobController.cs
+
3
−
13
View file @ d1bc7ffe
Edit in single-file editor
Open in Web IDE
Show full file
using
Coscine.Api.Blob.Util
;
using
Coscine.ApiCommons
;
using
Coscine.Configuration
;
using
Coscine.Database.DataModel
;
@@ -36,6 +35,7 @@ namespace Coscine.Api.Blob.Controllers
private
readonly
CoscineLogger
_coscineLogger
;
private
readonly
AnalyticsLogObject
_analyticsLogObject
;
private
readonly
RdfStoreConnector
_rdfStoreConnector
;
private
readonly
CoscineLDPHelper
_coscineLDPHelper
;
private
readonly
string
_prefix
;
/// <summary>
@@ -54,17 +54,7 @@ namespace Coscine.Api.Blob.Controllers
_coscineLogger
=
new
CoscineLogger
(
logger
);
_analyticsLogObject
=
new
AnalyticsLogObject
();
_prefix
=
_configuration
.
GetStringAndWait
(
"coscine/global/epic/prefix"
);
}
/// <summary>
/// Generates Id
/// </summary>
/// <param name="resourceId">Id of the resource</param>
/// <param name="path"> Path to file</param>
/// <returns> Uri </returns>
public
Uri
GenerateId
(
string
resourceId
,
string
path
)
{
return
new
CustomUri
(
$"https://hdl.handle.net/
{
_prefix
}
/
{
resourceId
}
@path=
{
Uri
.
EscapeDataString
(
path
)}
"
);
_coscineLDPHelper
=
new
CoscineLDPHelper
(
_rdfStoreConnector
,
_prefix
);
}
/// <summary>
@@ -225,7 +215,7 @@ namespace Coscine.Api.Blob.Controllers
return
BadRequest
(
"Only one file can be uploaded per request."
);
}
var
id
=
Generate
Id
(
resourceId
,
$"/
{
path
}
"
);
var
id
=
_coscineLDPHelper
.
Get
Id
(
resourceId
,
$"/
{
path
}
"
,
true
);
if
(!
_rdfStoreConnector
.
HasGraph
(
id
))
{
return
StatusCode
((
int
)
HttpStatusCode
.
Forbidden
,
Loading