diff --git a/docs-importer/main.js b/docs-importer/main.js index 71c4ac40..20600f5c 100644 --- a/docs-importer/main.js +++ b/docs-importer/main.js @@ -393,6 +393,12 @@ const importFile = (file, remove, resolve) => { // Intersect tags from filename with existing tags on server let foundtags = []; for (let j of taglist) { + // If the tag is last in the filename it could include a file extension and would not be recognized + if (j.includes('.') && !tagsarray.hasOwnProperty(j) && !foundtags.includes(tagsarray[j])) { + while (j.includes('.') && !tagsarray.hasOwnProperty(j)) { + j = j.replace(/\.[^.]*$/,''); + } + } if (tagsarray.hasOwnProperty(j) && !foundtags.includes(tagsarray[j])) { foundtags.push(tagsarray[j]); filename = filename.split('#'+j).join(''); @@ -413,7 +419,8 @@ const importFile = (file, remove, resolve) => { else { data = { title: prefs.importer.addtags ? filename : file.replace(/^.*[\\\/]/, '').substring(0, 100), - language: prefs.importer.lang || 'eng' + language: prefs.importer.lang || 'eng', + tags: prefs.importer.tag === '' ? undefined : prefs.importer.tag } } // Create document