Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Wolfgang Knopki
Spacedeck-open-SAML
Commits
8ee33864
Commit
8ee33864
authored
Jan 08, 2018
by
mntmn
Browse files
fix tmp dir in artifact uploader
parent
0d92343d
Changes
1
Hide whitespace changes
Inline
Side-by-side
helpers/artifact_converter.js
View file @
8ee33864
...
...
@@ -7,6 +7,7 @@ const fs = require('fs');
const
Models
=
require
(
'
../models/schema
'
);
const
uploader
=
require
(
'
../helpers/uploader
'
);
const
path
=
require
(
'
path
'
);
const
os
=
require
(
'
os
'
);
const
fileExtensionMap
=
{
"
.amr
"
:
"
audio/AMR
"
,
...
...
@@ -245,13 +246,12 @@ function resizeAndUpload(a, size, max, fileName, localFilePath, callback) {
if
(
max
>
320
||
size
.
width
>
max
||
size
.
height
>
max
)
{
var
resizedFileName
=
max
+
"
_
"
+
fileName
;
var
s3Key
=
"
s
"
+
a
.
space_id
.
toString
()
+
"
/a
"
+
a
.
_id
.
toString
()
+
"
/
"
+
resizedFileName
;
var
localResizedFilePath
=
"
/tmp
/
"
+
resizedFileName
;
var
localResizedFilePath
=
os
.
tmpdir
()
+
"
/
"
+
resizedFileName
;
gm
(
localFilePath
).
resize
(
max
,
max
).
autoOrient
().
write
(
localResizedFilePath
,
function
(
err
)
{
if
(
!
err
)
{
uploader
.
uploadFile
(
s3Key
,
"
image/jpeg
"
,
localResizedFilePath
,
function
(
err
,
url
)
{
if
(
err
)
callback
(
err
);
else
{
console
.
log
(
localResizedFilePath
);
fs
.
unlink
(
localResizedFilePath
,
function
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment