mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 05:57:57 +01:00
Fix tag-adding bugs of the importer (#427)
This commit is contained in:
parent
7ad0dd43e2
commit
041b2dfcc1
@ -393,6 +393,12 @@ const importFile = (file, remove, resolve) => {
|
|||||||
// Intersect tags from filename with existing tags on server
|
// Intersect tags from filename with existing tags on server
|
||||||
let foundtags = [];
|
let foundtags = [];
|
||||||
for (let j of taglist) {
|
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])) {
|
if (tagsarray.hasOwnProperty(j) && !foundtags.includes(tagsarray[j])) {
|
||||||
foundtags.push(tagsarray[j]);
|
foundtags.push(tagsarray[j]);
|
||||||
filename = filename.split('#'+j).join('');
|
filename = filename.split('#'+j).join('');
|
||||||
@ -413,7 +419,8 @@ const importFile = (file, remove, resolve) => {
|
|||||||
else {
|
else {
|
||||||
data = {
|
data = {
|
||||||
title: prefs.importer.addtags ? filename : file.replace(/^.*[\\\/]/, '').substring(0, 100),
|
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
|
// Create document
|
||||||
|
Loading…
Reference in New Issue
Block a user