Skip to content

Commit

Permalink
Added trim() to labels to remove \r line feed. Tsk!
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Jan 30, 2024
1 parent 253a788 commit 83f943c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2807,13 +2807,13 @@ async function onUpdateLocale(labels){
if (STATE.model === 'v2.4'){
for (let i = 0; i < labels.length; i++){
const id = i;
const [sname, cname] = labels[i].split('_');
const [sname, cname] = labels[i].trim().split('_');
await diskDB.runAsync('UPDATE species SET cname = ? WHERE id = ?', cname, id);
await memoryDB.runAsync('UPDATE species SET cname = ? WHERE id = ?', cname, id);
}
} else {
for (let i = 0; i < labels.length; i++) {
const [sname, common] = labels[i].split('_');
const [sname, common] = labels[i].trim().split('_');
// Check if the existing cname ends with a word or words in brackets
const existingCnameResult = await memoryDB.allAsync('SELECT id, cname FROM species WHERE sname = ?', sname);
if (existingCnameResult.length) {
Expand Down

0 comments on commit 83f943c

Please sign in to comment.