Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d8b5493a
authored
Jan 11, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Unhandled error on previous profile image deletion fixed
parent
af574442
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
sails/src/api/controllers/StudentController.js
sails/src/api/controllers/SupervisorController.js
sails/src/api/controllers/StudentController.js
View file @
d8b5493a
...
@@ -1018,7 +1018,8 @@ module.exports = {
...
@@ -1018,7 +1018,8 @@ module.exports = {
try
{
try
{
newAvatarFileDescriptor
=
uploadedFiles
[
0
].
fd
;
newAvatarFileDescriptor
=
uploadedFiles
[
0
].
fd
;
if
(
student
.
pic
!==
sails
.
config
.
pictogram
.
paths
.
defaultAvatarFileName
)
{
if
(
student
.
pic
!==
sails
.
config
.
pictogram
.
paths
.
defaultAvatarFileName
)
{
fs
.
unlinkSync
(
path
.
join
(
newAvatarDirectory
,
student
.
pic
));
if
(
fs
.
existsSync
(
path
.
join
(
newAvatarDirectory
,
student
.
pic
)))
fs
.
unlinkSync
(
path
.
join
(
newAvatarDirectory
,
student
.
pic
));
}
}
student
.
pic
=
newAvatarFileName
;
student
.
pic
=
newAvatarFileName
;
...
@@ -1028,9 +1029,9 @@ module.exports = {
...
@@ -1028,9 +1029,9 @@ module.exports = {
}
}
res
.
ok
({
file
:
{
name
:
student
.
pic
}});
res
.
ok
({
file
:
{
name
:
student
.
pic
}});
});
});
}
catch
(
updateAvatarErro
r
)
{
}
catch
(
er
r
)
{
fs
.
unlinkSync
(
newAvatarFileDescriptor
);
fs
.
unlinkSync
(
newAvatarFileDescriptor
);
res
.
serverError
(
"Error when updating profile image in server
"
);
res
.
serverError
(
"Error when updating profile image in server
: "
+
err
);
}
}
});
});
})
})
...
...
sails/src/api/controllers/SupervisorController.js
View file @
d8b5493a
...
@@ -542,7 +542,8 @@ module.exports = {
...
@@ -542,7 +542,8 @@ module.exports = {
newAvatarFileDescriptor
=
uploadedFiles
[
0
].
fd
;
newAvatarFileDescriptor
=
uploadedFiles
[
0
].
fd
;
if
(
supervisor
.
pic
!==
sails
.
config
.
pictogram
.
paths
.
defaultAvatarFileName
)
{
if
(
supervisor
.
pic
!==
sails
.
config
.
pictogram
.
paths
.
defaultAvatarFileName
)
{
sails
.
log
.
debug
(
"removing old profile image"
);
sails
.
log
.
debug
(
"removing old profile image"
);
fs
.
unlinkSync
(
path
.
join
(
newAvatarDirectory
,
supervisor
.
pic
));
if
(
fs
.
existsSync
(
path
.
join
(
newAvatarDirectory
,
supervisor
.
pic
)))
fs
.
unlinkSync
(
path
.
join
(
newAvatarDirectory
,
supervisor
.
pic
));
}
}
supervisor
.
pic
=
newAvatarFileName
;
supervisor
.
pic
=
newAvatarFileName
;
...
...
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