Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xpub-epmc
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Literature-services
public-projects
xpub-epmc
Commits
f6f4662e
Commit
f6f4662e
authored
6 years ago
by
Yogmatee Roochun
Browse files
Options
Downloads
Plain Diff
Merge branch 'shared-data-model' of gitlab.coko.foundation:xpub/xpub-epmc into shared-data-model
parents
00aff8c6
345e3671
No related branches found
No related tags found
2 merge requests
!90
Dev
,
!88
Shared data model
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/minio-server/src/FileBackend.js
+5
-15
5 additions, 15 deletions
server/minio-server/src/FileBackend.js
with
5 additions
and
15 deletions
server/minio-server/src/FileBackend.js
+
5
−
15
View file @
f6f4662e
const
config
=
require
(
'
config
'
)
const
expressMinio
=
require
(
'
express-middleware-minio
'
)
const
minioMiddleware
=
expressMinio
.
middleware
()
...
...
@@ -32,19 +31,14 @@ module.exports = app => {
app
.
get
(
`/api/files/:filename`
,
minioMiddleware
({
op
:
expressMinio
.
Ops
.
get
}),
minioMiddleware
({
op
:
expressMinio
.
Ops
.
get
Stream
}),
(
req
,
res
)
=>
{
if
(
req
.
minio
.
error
)
{
res
.
status
(
400
).
json
({
error
:
req
.
minio
.
error
})
return
}
res
.
sendFile
(
req
.
minio
.
get
.
path
,
{},
err
=>
{
if
(
err
)
{
res
.
status
(
500
).
json
({
err
})
}
expressMinio
.
utils
.
removeFile
(
req
.
minio
.
get
.
path
)
})
req
.
minio
.
get
.
stream
.
pipe
(
res
)
},
)
...
...
@@ -64,19 +58,15 @@ module.exports = app => {
* files for the pdf conversion stage. */
app
.
get
(
`
${
download_path
}
/:filename`
,
minioMiddleware
({
op
:
expressMinio
.
Ops
.
get
}),
minioMiddleware
({
op
:
expressMinio
.
Ops
.
get
Stream
}),
(
req
,
res
)
=>
{
if
(
req
.
minio
.
error
)
{
res
.
status
(
400
).
json
({
error
:
req
.
minio
.
error
})
return
}
res
.
download
(
req
.
minio
.
get
.
path
,
req
.
minio
.
get
.
originalName
,
err
=>
{
if
(
err
)
{
console
.
warn
(
'
Download failed:
'
,
err
)
}
expressMinio
.
utils
.
removeFile
(
req
.
minio
.
get
.
path
)
})
res
.
attachment
(
req
.
minio
.
get
.
originalName
)
req
.
minio
.
get
.
stream
.
pipe
(
res
)
},
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
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