Fix invalid imported Mendeley annotation color
After fix in 808b71832e
And require annotation colors to be 6-char hex colors going forward
This commit is contained in:
parent
f925f0e402
commit
7e23cfef96
3 changed files with 14 additions and 1 deletions
|
@ -3706,6 +3706,15 @@ for (let name of ['type', 'text', 'comment', 'color', 'pageLabel', 'sortIndex',
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'color':
|
||||||
|
// Require 6-char hex value
|
||||||
|
if (!value.match(/#[a-f0-9]{6}/)) {
|
||||||
|
let e = new Error(`Invalid annotation color '${value}'`);
|
||||||
|
e.name = "ZoteroInvalidDataError";
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'sortIndex':
|
case 'sortIndex':
|
||||||
if (!/^\d{5}\|\d{6}\|\d{5}$/.test(value)) {
|
if (!/^\d{5}\|\d{6}\|\d{5}$/.test(value)) {
|
||||||
throw new Error(`Invalid sortIndex '${value}`);
|
throw new Error(`Invalid sortIndex '${value}`);
|
||||||
|
|
|
@ -3268,6 +3268,10 @@ Zotero.Schema = new function(){
|
||||||
yield Zotero.DB.queryAsync("DELETE FROM items WHERE itemTypeID=? AND itemID NOT IN (SELECT itemID FROM itemAnnotations)", annotationID);
|
yield Zotero.DB.queryAsync("DELETE FROM items WHERE itemTypeID=? AND itemID NOT IN (SELECT itemID FROM itemAnnotations)", annotationID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (i == 114) {
|
||||||
|
yield Zotero.DB.queryAsync("UPDATE itemAnnotations SET color='#ffff00' WHERE color='#ffff0'");
|
||||||
|
}
|
||||||
|
|
||||||
// If breaking compatibility or doing anything dangerous, clear minorUpdateFrom
|
// If breaking compatibility or doing anything dangerous, clear minorUpdateFrom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- 113
|
-- 114
|
||||||
|
|
||||||
-- Copyright (c) 2009 Center for History and New Media
|
-- Copyright (c) 2009 Center for History and New Media
|
||||||
-- George Mason University, Fairfax, Virginia, USA
|
-- George Mason University, Fairfax, Virginia, USA
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue