diff --git a/core/server/api/v2/themes.js b/core/server/api/v2/themes.js index 4fe2d8d0bf..1034e897e3 100644 --- a/core/server/api/v2/themes.js +++ b/core/server/api/v2/themes.js @@ -28,8 +28,13 @@ module.exports = { } }, permissions: true, - query(frame) { + async query(frame) { let themeName = frame.options.name; + + if (limitService.isLimited('customThemes')) { + await limitService.errorIfWouldGoOverLimit('customThemes', {value: themeName}); + } + const newSettings = [{ key: 'active_theme', value: themeName @@ -54,7 +59,8 @@ module.exports = { }, async query(frame) { if (limitService.isLimited('customThemes')) { - await limitService.errorIfWouldGoOverLimit('customThemes'); + // Sending a bad string to make sure it fails (empty string isn't valid) + await limitService.errorIfWouldGoOverLimit('customThemes', {value: '.'}); } // @NOTE: consistent filename uploads diff --git a/core/server/api/v3/themes.js b/core/server/api/v3/themes.js index 35346ff5b7..ab1af77bac 100644 --- a/core/server/api/v3/themes.js +++ b/core/server/api/v3/themes.js @@ -28,8 +28,13 @@ module.exports = { } }, permissions: true, - query(frame) { + async query(frame) { let themeName = frame.options.name; + + if (limitService.isLimited('customThemes')) { + await limitService.errorIfWouldGoOverLimit('customThemes', {value: themeName}); + } + const newSettings = [{ key: 'active_theme', value: themeName @@ -54,7 +59,8 @@ module.exports = { }, async query(frame) { if (limitService.isLimited('customThemes')) { - await limitService.errorIfWouldGoOverLimit('customThemes'); + // Sending a bad string to make sure it fails (empty string isn't valid) + await limitService.errorIfWouldGoOverLimit('customThemes', {value: '.'}); } // @NOTE: consistent filename uploads