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
Commits
ac9343c7
Commit
ac9343c7
authored
4 years ago
by
Marcel Nellesen
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Removed Download and Upload Url functions
parent
e26d7e9d
Branches
Sprint/2021-07
Branches containing commit
Tags
Tags containing commit
1 merge request
!31
Sprint/2021 07
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Blob/Controllers/BlobController.cs
+0
-67
0 additions, 67 deletions
src/Blob/Controllers/BlobController.cs
with
0 additions
and
67 deletions
src/Blob/Controllers/BlobController.cs
+
0
−
67
View file @
ac9343c7
...
...
@@ -180,73 +180,6 @@ namespace Coscine.Api.Blob.Controllers
}
}
/// <summary>
/// This method returns the download url for a resource and path
/// </summary>
/// <param name="resourceId">Id of the resource</param>
/// <param name="path">Path to the to downloaded file</param>
/// <returns>Uri of the download url in the form of: "{ data: { url: url } }"</returns>
[
HttpGet
(
"[controller]/downloadUrl/{resourceId}/{*path}"
)]
public
async
Task
<
IActionResult
>
GetDownloadUrl
(
string
resourceId
,
string
path
)
{
return
await
GetUrl
(
resourceId
,
path
,
(
resourceTypeDefinition
,
path
,
version
,
resourceTypeOptions
)
=>
resourceTypeDefinition
.
GetEntryDownloadUrl
(
path
,
version
,
resourceTypeOptions
));
}
/// <summary>
/// This method returns the upload url for a resource and path
/// </summary>
/// <param name="resourceId">Id of the resource</param>
/// <param name="path">Path to the to uploaded file</param>
/// <returns>Uri of the upload url in the form of: "{ data: { url: url } }"</returns>
[
HttpGet
(
"[controller]/uploadUrl/{resourceId}/{*path}"
)]
public
async
Task
<
IActionResult
>
GetUploadUrl
(
string
resourceId
,
string
path
)
{
return
await
GetUrl
(
resourceId
,
path
,
(
resourceTypeDefinition
,
path
,
version
,
resourceTypeOptions
)
=>
resourceTypeDefinition
.
GetEntryStoreUrl
(
path
,
version
,
resourceTypeOptions
));
}
private
async
Task
<
IActionResult
>
GetUrl
(
string
resourceId
,
string
path
,
Func
<
ResourceTypeDefinition
,
string
,
string
,
Dictionary
<
string
,
string
>,
Task
<
Uri
>>
receiver
)
{
var
rawPath
=
path
;
var
user
=
_authenticator
.
GetUser
();
path
=
$"/
{
path
}
"
;
var
checkPath
=
CheckPath
(
path
);
if
(
checkPath
!=
null
)
{
return
checkPath
;
}
var
checkResourceId
=
CheckResource
(
resourceId
,
out
Resource
resource
);
if
(
checkResourceId
!=
null
)
{
return
checkResourceId
;
}
var
checkUser
=
CheckUser
(
user
,
resource
);
if
(
checkUser
!=
null
)
{
return
checkUser
;
}
var
resourceTypeOptions
=
_resourceModel
.
GetResourceTypeOptions
(
resource
.
Id
);
var
resourceTypeDefinition
=
ResourceTypeFactory
.
CreateResourceTypeObject
(
resource
.
Type
.
DisplayName
,
_configuration
);
if
(
resourceTypeDefinition
==
null
)
{
return
BadRequest
(
$"No provider for: \"
{
resource
.
Type
.
DisplayName
}
\"."
);
}
var
entryUrl
=
await
receiver
(
resourceTypeDefinition
,
rawPath
,
null
,
resourceTypeOptions
);
if
(
entryUrl
==
null
)
{
var
hostUrl
=
await
_configuration
.
GetStringAsync
(
"coscine/local/api/additional/url"
);
var
apiPath
=
$"/coscine/api/
{((
System
.
Reflection
.
Assembly
.
GetEntryAssembly
()
!=
null
)
?
System
.
Reflection
.
Assembly
.
GetEntryAssembly
().
GetName
().
Name
:
System
.
Reflection
.
Assembly
.
GetExecutingAssembly
().
GetName
().
Name
)}
"
;
entryUrl
=
new
Uri
(
$"
{
hostUrl
}{
apiPath
}
/Blob/
{
resourceId
}
/
{
rawPath
}
"
);
}
return
Ok
(
$"
{{
\
"data\": {{ \"url\": \"{entryUrl}\" }} }}"
);
}
/// <summary>
/// This method uploads a given File
/// </summary>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment