From 6b5b793ed01f8b14e320c16a6701cbf68ed27376 Mon Sep 17 00:00:00 2001 From: JamesJJT Date: Wed, 27 Mar 2024 23:10:12 +0000 Subject: [PATCH 1/2] Fix bug with spaces in hubsupport search --- lib/commands/hubsupport.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/commands/hubsupport.js b/lib/commands/hubsupport.js index c0752c20a..9fbd65352 100644 --- a/lib/commands/hubsupport.js +++ b/lib/commands/hubsupport.js @@ -34,7 +34,9 @@ export default { .setAutocomplete(true) ), async execute (interaction) { - const value = interaction.options.getString('name') + let value = interaction.options.getString('name') + // Replace spaces with dashes to fix an issue with spaces not returning anything + value = value.replace(/\s+/g, '-') if (!value) { return interaction.followUp('Support for hub plugins should be directed to the author of the plugin.\nYou can find the support link by searching for the plugin in the Plugin Hub panel and clicking the `?` button on the plugin, or by right-clicking the plugin in the plugin panel and clicking the `Support` menu option.') From e61782278b3c09ad59478d1e2e0c17c5bb2c3007 Mon Sep 17 00:00:00 2001 From: JamesJJT Date: Thu, 28 Mar 2024 16:50:16 +0000 Subject: [PATCH 2/2] Move replace below, isset check. --- lib/commands/hubsupport.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/commands/hubsupport.js b/lib/commands/hubsupport.js index 9fbd65352..e2f0fa8cb 100644 --- a/lib/commands/hubsupport.js +++ b/lib/commands/hubsupport.js @@ -35,13 +35,14 @@ export default { ), async execute (interaction) { let value = interaction.options.getString('name') - // Replace spaces with dashes to fix an issue with spaces not returning anything - value = value.replace(/\s+/g, '-') if (!value) { return interaction.followUp('Support for hub plugins should be directed to the author of the plugin.\nYou can find the support link by searching for the plugin in the Plugin Hub panel and clicking the `?` button on the plugin, or by right-clicking the plugin in the plugin panel and clicking the `Support` menu option.') } + // Replace spaces with dashes to fix an issue with spaces not returning anything + value = value.replace(/\s+/g, '-') + const manifest = await fetchManifest() const plugin = manifest.display.find(p => p.internalName === value)