From 5503c042162c19e88f8e1481a232ad0f67ffe42a Mon Sep 17 00:00:00 2001 From: Oliver Fawcett-Griffiths Date: Sat, 10 Jul 2021 05:16:32 +1200 Subject: [PATCH] Lowercase filenames to match default slugs (#312) * Lowercase filenames to match default slugs Currently, all slugs are forced to lowercase on Readme.com. However when syncing, it left the name as uppercase, which **always** resulted in a 404, and thus a new page being created. * Lowercase filenames to match default slugs Currently, all slugs are forced to lowercase on Readme.com. However when syncing, it left the name as uppercase, which **always** resulted in a 404, and thus a new page being created. --- src/cmds/docs/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmds/docs/index.js b/src/cmds/docs/index.js index d61d20397..333034eb7 100644 --- a/src/cmds/docs/index.js +++ b/src/cmds/docs/index.js @@ -93,8 +93,8 @@ exports.run = function (opts) { files.map(async filename => { const file = await readFile(path.join(folder, filename), 'utf8'); const matter = frontMatter(file); - // Stripping the markdown extension from the filename - const slug = filename.replace(path.extname(filename), ''); + // Stripping the markdown extension from the filename and lowecasing to get the default slug + const slug = filename.replace(path.extname(filename), '').toLowerCase(); const hash = crypto.createHash('sha1').update(file).digest('hex'); return request