fix lowercasing issue'

merge-requests/11/merge
Matthew 2020-05-06 16:31:04 -04:00
parent 884a81d4b8
commit 96bcaed4b1
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ export default class AddRedirect extends Command {
const check = await this.client.db.redirect.findOne({ key: args[1].toLowerCase() });
if (check) return this.error(message.channel, `Redirect key ${args[1].toLowerCase()} already exists. Linked to: ${check.to}`);
try {
const test = new URL(args[0].toLowerCase());
const test = new URL(args[0]);
if (test.protocol !== 'https:') return this.error(message.channel, 'Protocol must be HTTPS.');
} catch {
return this.error(message.channel, 'This doesn\'t appear to be a valid URL.');
@ -27,10 +27,10 @@ export default class AddRedirect extends Command {
// eslint-disable-next-line new-cap
const redirect = new this.client.db.redirect({
key: args[1].toLowerCase(),
to: args[0].toLowerCase(),
to: args[0],
});
await redirect.save();
return this.success(message.channel, `Redirect https://loc.sh/${args[1].toLowerCase()} -> ${args[0].toLowerCase()} is now active.`);
return this.success(message.channel, `Redirect https://loc.sh/${args[1].toLowerCase()} -> ${args[0]} is now active.`);
} catch (err) {
return this.client.util.handleError(err, message, this);
}