summaryrefslogtreecommitdiff
path: root/server/lib
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-08-14 15:21:48 -0400
committerJules Laplace <jules@okfoc.us>2014-08-14 15:21:48 -0400
commit63da3ba331aa3d9714151ba5f502e6e1851d75bb (patch)
tree7cbfccd4a2dff47f7791a0b70fbc4e0c845d11f6 /server/lib
parent410607684c7273a61f937635b41397208e245473 (diff)
only clobber thumbnail if layout changed
Diffstat (limited to 'server/lib')
-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){