mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-30 18:46:01 +01:00 
			
		
		
		
	fix: handle cases where incoming ap object tag can be a non-array
This commit is contained in:
		| @@ -31,7 +31,13 @@ async function unlock(value) { | |||||||
| Notes._normalizeTags = async (tag, cid) => { | Notes._normalizeTags = async (tag, cid) => { | ||||||
| 	const systemTags = (meta.config.systemTags || '').split(','); | 	const systemTags = (meta.config.systemTags || '').split(','); | ||||||
| 	const maxTags = await categories.getCategoryField(cid, 'maxTags'); | 	const maxTags = await categories.getCategoryField(cid, 'maxTags'); | ||||||
| 	const tags = (tag || []) | 	let tags = tag || []; | ||||||
|  |  | ||||||
|  | 	if (!Array.isArray(tags)) { // the "|| []" should handle null/undefined values... #famouslastwords | ||||||
|  | 		tags = [tags]; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	tags = tags | ||||||
| 		.map((tag) => { | 		.map((tag) => { | ||||||
| 			tag.name = tag.name.startsWith('#') ? tag.name.slice(1) : tag.name; | 			tag.name = tag.name.startsWith('#') ? tag.name.slice(1) : tag.name; | ||||||
| 			return tag; | 			return tag; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user