diff --git a/src/functions.js b/src/functions.js
index f86bff1..c4762c3 100644
--- a/src/functions.js
+++ b/src/functions.js
@@ -44,7 +44,7 @@ export function render_tags(tags) {
}
else {
for (let tag_index = 0; tag_index < tags.length; tag_index++) { // Loop over each tag
- string += `${tags[tag_index]}` // Adds the tag to the string as a HTML href
+ string += `${tags[tag_index].trim()}` // Adds the tag to the string as a HTML href
if (tag_index < tags.length - 1) { // If there are more tags, then insert a comma
string += ", ";
}
diff --git a/src/server.js b/src/server.js
index ed11d22..dd34430 100644
--- a/src/server.js
+++ b/src/server.js
@@ -360,7 +360,7 @@ app.post("/submit_post", (req,res) => {
const username = func.escape_input(req.body.username)
const title = func.escape_input(req.body.title)
const content = req.body.content
- const tags = func.escape_input(req.body.tags).split(',');
+ const tags = func.escape_input(req.body.tags).split(',').map(str => str.trim());
const unix_timestamp = getUnixTime(new Date())
if (func.get_userID(username) == -1) {
@@ -486,7 +486,7 @@ app.post("/submit_edit_post", (req,res) => {
const userID = req.body.userID
const title = func.escape_input(req.body.title)
const content = req.body.content
- const tags = func.escape_input(req.body.tags).split(",")
+ const tags = func.escape_input(req.body.tags).split(",").map(str => str.trim());
const delete_bool = req.body.delete
const unix_timestamp = getUnixTime(new Date())
console.log(users[userID]['prettyname'], "is editting the post titled:", title);