Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
a175dbd6
Verified
Commit
a175dbd6
authored
1 year ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
feat: upload a file for a show now get the showId from the database
parent
08e1d48a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/v1/files_upload.go
+9
-8
9 additions, 8 deletions
api/v1/files_upload.go
with
9 additions
and
8 deletions
api/v1/files_upload.go
+
9
−
8
View file @
a175dbd6
...
...
@@ -385,7 +385,6 @@ func getFlowJSParameterFromQuery(r *http.Request) (id string, chunk, totalChunks
// @Summary Upload file content
// @Description Uploads file content via flow.js. Only available if file was created using SourceURI set to upload://-type and file import state is running.
// @Accept mpfd
// @Param showID query int true "ID of the show"
// @Param id path int true "ID of the file"
// @Success 200 {object} nil
// @Failure 400 {object} ErrorResponse
...
...
@@ -394,17 +393,19 @@ func getFlowJSParameterFromQuery(r *http.Request) (id string, chunk, totalChunks
// @Failure 500 {object} ErrorResponse
// @Router /api/v1/upload/{id} [post]
func
(
api
*
API
)
UploadFileFlowJS
(
c
*
gin
.
Context
)
{
showID
,
err
:=
getShowID
(
c
)
id
,
err
:=
idFromString
(
c
.
Param
(
"file-id"
)
)
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusBadRequest
,
ErrorResponse
{
Error
:
"invalid showId: "
+
err
.
Error
()})
}
if
authorized
,
_
:=
authorizeRequestForShow
(
c
,
showID
);
!
authorized
{
c
.
JSON
(
http
.
StatusBadRequest
,
ErrorResponse
{
Error
:
"invalid file-id: "
+
err
.
Error
()})
return
}
id
,
err
:=
idFromString
(
c
.
Param
(
"file-id"
))
// get the showId for this file from the database
showId
,
err
:=
api
.
store
.
GetFileShowID
(
id
)
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusBadRequest
,
ErrorResponse
{
Error
:
"invalid file-id: "
+
err
.
Error
()})
c
.
JSON
(
http
.
StatusBadRequest
,
ErrorResponse
{
Error
:
"invalid showId: "
+
err
.
Error
()})
}
if
authorized
,
_
:=
authorizeRequestForShow
(
c
,
showId
);
!
authorized
{
return
}
flowId
,
chunk
,
totalChunks
,
chunkSize
,
totalSize
,
data
,
err
:=
getFlowJSParameterFromMultipart
(
c
.
Request
)
...
...
@@ -413,7 +414,7 @@ func (api *API) UploadFileFlowJS(c *gin.Context) {
return
}
job
,
err
:=
api
.
importer
.
GetJob
(
showI
D
,
id
)
job
,
err
:=
api
.
importer
.
GetJob
(
showI
d
,
id
)
if
err
!=
nil
{
sendError
(
c
,
err
)
return
...
...
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