Skip to content

Commit 3e09c7a

Browse files
authored
Merge pull request #1505 from daniele-athome/pr/feature/tags-array
Use array for tags when available (close #1496)
2 parents b142c02 + 5463c84 commit 3e09c7a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/models/note.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,13 @@ module.exports = function (sequelize, DataTypes) {
367367
Note.extractNoteTags = function (meta, $) {
368368
var tags = []
369369
var rawtags = []
370+
var metaTags
370371
if (meta.tags && (typeof meta.tags === 'string' || typeof meta.tags === 'number')) {
371-
var metaTags = ('' + meta.tags).split(',')
372+
metaTags = ('' + meta.tags).split(',')
373+
} else if (meta.tags && (Array.isArray(meta.tags))) {
374+
metaTags = meta.tags
375+
}
376+
if (metaTags) {
372377
for (let i = 0; i < metaTags.length; i++) {
373378
var text = metaTags[i].trim()
374379
if (text) rawtags.push(text)

0 commit comments

Comments
 (0)