From f16598f2384db68c06cdff7df4d795c1eafc247f Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Tue, 22 Jul 2025 14:39:09 -0400 Subject: [PATCH] Fix Google ID Validation Regex Google IDs with underscores were failing. Regex found in Google drive documentation: https://developers.google.com/workspace/docs/api/concepts/document --- server/homebrew.api.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index e6582d363..0af6e458c 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -52,13 +52,13 @@ const api = { // ID Validation Checks // Homebrewery ID // Typically 12 characters, but the DB shows a range of 7 to 14 characters - if(!id.match(/^[A-Za-z0-9_-]{7,14}$/)){ + if(!id.match(/^[a-zA-Z0-9-_]{7,14}$/)){ throw { name: 'ID Error', message: 'Invalid ID', status: 404, HBErrorCode: '11', brewId: id }; } // Google ID // Typically 33 characters, old format is 44 - always starts with a 1 // Managed by Google, may change outside of our control, so any length between 33 and 44 is acceptable - if(googleId && !googleId.match(/^1(?:[A-Za-z0-9+\/]{32,43})$/)){ + if(googleId && !googleId.match(/^1(?:[a-zA-Z0-9-_]{32,43})$/)){ throw { name: 'Google ID Error', message: 'Invalid ID', status: 404, HBErrorCode: '12', brewId: id }; } @@ -537,4 +537,4 @@ router.delete('/api/:id', checkClientVersion, asyncHandler(api.deleteBrew)); router.get('/api/remove/:id', checkClientVersion, asyncHandler(api.deleteBrew)); router.get('/api/theme/:renderer/:id', asyncHandler(api.getThemeBundle)); -export default api; \ No newline at end of file +export default api;