From 982ccb65df9dbdc43f04e013acc0787a411e47c4 Mon Sep 17 00:00:00 2001 From: Sleeyax Date: Tue, 15 Oct 2024 00:19:08 +0200 Subject: [PATCH] Fix slug sanitization of non-alphanumeric characters Not all non-alphanumeric characters are added to the charmap yet but this should fix the current issue with the Easynews addon. --- build.js | 2 +- lib/discord.js | 2 +- lib/slug.js | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 lib/slug.js diff --git a/build.js b/build.js index 2ab2b88..e5f7b98 100644 --- a/build.js +++ b/build.js @@ -1,5 +1,5 @@ const fs = require('fs') -const slug = require('slug') +const slug = require('./lib/slug') const needle = require('needle') const asyncQueue = require('async.queue') const config = require('./config') diff --git a/lib/discord.js b/lib/discord.js index 20f483c..084a3b3 100644 --- a/lib/discord.js +++ b/lib/discord.js @@ -1,5 +1,5 @@ const config = require('../config') -const slug = require('slug') +const slug = require('../lib/slug') const needle = require('needle') const discordGreeting = () => { diff --git a/lib/slug.js b/lib/slug.js new file mode 100644 index 0000000..1d51066 --- /dev/null +++ b/lib/slug.js @@ -0,0 +1,7 @@ +const _slug = require('slug') + +_slug.charmap['+'] = 'plus' + +const slug = (string, opts) => _slug(string, opts) + +module.exports = slug