summaryrefslogtreecommitdiff
path: root/server/lib/api/projects.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-08-14 15:24:34 -0400
committerJules Laplace <jules@okfoc.us>2014-08-14 15:24:34 -0400
commit31907c69cc192a23bb409adf5c438ed708db0842 (patch)
tree516a88386f96606b1890c83e5083fdb943582a68 /server/lib/api/projects.js
parentc4c45b64c2c0fc109f4c21effe7f73f5c46a1ae9 (diff)
parent63da3ba331aa3d9714151ba5f502e6e1851d75bb (diff)
merge
Diffstat (limited to 'server/lib/api/projects.js')
-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){