From 580f15da3d439512fdbf023b211d3e22376cb060 Mon Sep 17 00:00:00 2001 From: Trivernis Date: Tue, 29 Oct 2019 17:20:32 +0100 Subject: [PATCH] Fixed Handle whitespace - removed whitespace from handles - fixed character length not being detected --- .gitignore | 1 + src/lib/dataaccess.ts | 2 +- src/lib/globals.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 50ca305..36e8cf3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ config.yaml sqz-force greenvironment.db logs +logs* diff --git a/src/lib/dataaccess.ts b/src/lib/dataaccess.ts index 50b0cd6..b11897a 100644 --- a/src/lib/dataaccess.ts +++ b/src/lib/dataaccess.ts @@ -18,7 +18,7 @@ import * as models from "./models"; * @param username */ async function generateHandle(username: string) { - username = username.toLowerCase(); + username = username.toLowerCase().replace(/\s/g, "_"); const count = await models.User.count({where: {handle: {[sqz.Op.like]: `%${username}%`}}}); if (count > 0) { return `${username}${count}`; diff --git a/src/lib/globals.ts b/src/lib/globals.ts index 9063c49..9b13f38 100644 --- a/src/lib/globals.ts +++ b/src/lib/globals.ts @@ -9,7 +9,7 @@ import {EventEmitter} from "events"; import * as fsx from "fs-extra"; import * as yaml from "js-yaml"; import * as winston from "winston"; -require('winston-daily-rotate-file'); +require("winston-daily-rotate-file"); const configPath = "config.yaml"; const defaultConfig = __dirname + "/../default-config.yaml";