From 014eb28e0dbb93a6addd447c61b6a928e6f13a38 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sat, 1 Oct 2016 21:37:42 -0700 Subject: [PATCH] Fix regression for user profiles --- src/database/accounts.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/database/accounts.js b/src/database/accounts.js index 469a71c7..ce9a44a4 100644 --- a/src/database/accounts.js +++ b/src/database/accounts.js @@ -83,6 +83,15 @@ module.exports = { return callback("User does not exist"); } + try { + var profile = JSON.parse(rows[0].profile); + profile.image = profile.image || ""; + profile.text = profile.text || ""; + rows[0].profile = profile; + } catch (error) { + rows[0].profile = { image: "", text: "" }; + } + callback(null, rows[0]); }); },