Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
keeleliin
keeleliin-wrapper
Commits
a6c46d5e
Commit
a6c46d5e
authored
Aug 10, 2015
by
priit
Browse files
Mitme faili haldamise err
parent
0001c14b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/service/sessionService.js
View file @
a6c46d5e
...
...
@@ -5,6 +5,7 @@ var fs = require('fs');
var
daoService
=
require
(
'
./daoService
'
);
var
Session
=
require
(
'
../model/session
'
);
var
FileUtil
=
require
(
'
../util/file
'
);
var
async
=
require
(
'
async
'
);
function
SessionService
()
{
...
...
@@ -53,27 +54,23 @@ function SessionService() {
tmpList
.
push
(
files
[
i
]);
}
if
(
tmpList
.
length
>
0
){
self
.
_storeOnIndex
(
session
,
tmpList
,
0
,
cb
)
}
};
this
.
_storeOnIndex
=
function
(
session
,
tmpList
,
index
,
cb
)
{
var
tmpFile
=
tmpList
[
index
];
var
sessionFilePath
=
this
.
getNewFilePath
(
session
.
id
);
async
.
eachSeries
(
tmpList
,
function
(
item
,
callback
)
{
FileUtil
.
mv
(
tmpFile
.
path
,
sessionFilePath
,
function
(
err
){
if
(
err
)
return
cb
(
err
);
session
.
requestFiles
[
tmpFile
.
fieldname
]
=
sessionFilePath
;
var
tmpFile
=
item
;
var
sessionFilePath
=
self
.
getNewFilePath
(
session
.
id
);
if
(
index
<
tmpList
-
1
){
index
=
index
+
1
;
self
.
_storeOnIndex
(
session
,
tmpList
,
0
,
cb
)
}
else
{
cb
(
null
,
session
);
FileUtil
.
mv
(
tmpFile
.
path
,
sessionFilePath
,
function
(
err
){
if
(
err
)
return
callback
(
err
);
session
.
requestFiles
[
tmpFile
.
fieldname
]
=
sessionFilePath
;
callback
();
});
},
function
(
err
,
session
)
{
cb
(
err
,
session
);
}
}
);
);
};
this
.
getStorePath
=
function
(
sessionId
)
{
...
...
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