summaryrefslogtreecommitdiff
path: root/server/lib/api
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-08-22 19:41:37 -0400
committerJules Laplace <jules@okfoc.us>2014-08-22 19:41:37 -0400
commit2235c34e498499b8141e835998b962067583a0ce (patch)
tree22406e6484a7cccc1c72fb47cc4e5848f57ee2c4 /server/lib/api
parented5751766079a62ce596dcc0abc1a211b5b633dc (diff)
parent4ef340497ef24bb2ecacb2c9c4106c24515c874f (diff)
merge
Diffstat (limited to 'server/lib/api')
-rw-r--r--server/lib/api/projects.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/server/lib/api/projects.js b/server/lib/api/projects.js
index fc54a5f..bd3cb81 100644
--- a/server/lib/api/projects.js
+++ b/server/lib/api/projects.js
@@ -72,15 +72,20 @@ var projects = {
data.slug = util.slugify(data.name)
data.description = util.sanitize(data.description)
- upload.put("projects", req.files.thumbnail, {
- unacceptable: function(err){
- res.json({ error: { errors: { thumbnail: { message: "Problem saving thumbnail: " + err } } } })
- },
- success: function(url){
- data.photo = url
- done()
- }
- })
+ if (req.files.thumbnail) {
+ upload.put("projects", req.files.thumbnail, {
+ unacceptable: function(err){
+ res.json({ error: { errors: { thumbnail: { message: "Problem saving thumbnail: " + err } } } })
+ },
+ success: function(url){
+ data.photo = url
+ done()
+ }
+ })
+ }
+ else {
+ done()
+ }
function done() {
Project.findOne({ _id: _id }, function(err, doc){