Allow to unset background image

This commit is contained in:
Johannes Zellner
2022-05-15 12:14:17 +02:00
parent 93bacd00da
commit f3c66056b5
2 changed files with 6 additions and 5 deletions

View File

@@ -917,7 +917,7 @@ async function getBackgroundImage(id) {
async function setBackgroundImage(id, backgroundImage) {
assert.strictEqual(typeof id, 'string');
assert(Buffer.isBuffer(backgroundImage));
assert(Buffer.isBuffer(backgroundImage) || backgroundImage === null);
const result = await database.query('UPDATE users SET backgroundImage=? WHERE id = ?', [ backgroundImage, id ]);
if (result.length === 0) throw new BoxError(BoxError.NOT_FOUND, 'User not found');