Use array for tags when available (close #1496)

Signed-off-by: Daniele Ricci <daniele@casaricci.it>
This commit is contained in:
Daniele Ricci 2020-04-29 23:04:18 +02:00
parent 4fd6293963
commit 5463c8412c
1 changed files with 6 additions and 1 deletions

View File

@ -367,8 +367,13 @@ module.exports = function (sequelize, DataTypes) {
Note.extractNoteTags = function (meta, $) {
var tags = []
var rawtags = []
var metaTags
if (meta.tags && (typeof meta.tags === 'string' || typeof meta.tags === 'number')) {
var metaTags = ('' + meta.tags).split(',')
metaTags = ('' + meta.tags).split(',')
} else if (meta.tags && (Array.isArray(meta.tags))) {
metaTags = meta.tags
}
if (metaTags) {
for (let i = 0; i < metaTags.length; i++) {
var text = metaTags[i].trim()
if (text) rawtags.push(text)