05/18 Enhanced codes and functionalities 2

This commit is contained in:
2026-05-18 11:48:31 -04:00
parent fc4145a78e
commit 4364daecef
4 changed files with 45 additions and 16 deletions
+22 -7
View File
@@ -931,13 +931,22 @@ const Vault = (() => {
for (let i = 1; i < lines.length; i++) {
const line = lines[i].trim();
if (!line) continue;
// Simple CSV split — handles quoted fields containing commas.
// RFC 4180-compliant CSV split — handles quoted fields containing commas
// and embedded double-quotes escaped as "".
const cells = [];
let cur = "",
inQuote = false;
for (const ch of line + ",") {
const src = line + ",";
for (let ci = 0; ci < src.length; ci++) {
const ch = src[ci];
if (ch === '"') {
inQuote = !inQuote;
if (inQuote && src[ci + 1] === '"') {
// Escaped quote inside a quoted field: "" → "
cur += '"';
ci++; // skip the second quote
} else {
inQuote = !inQuote;
}
} else if (ch === "," && !inQuote) {
cells.push(cur.trim());
cur = "";
@@ -2856,10 +2865,16 @@ const Vault = (() => {
applyCurrentFilter();
return;
}
const pool = _activeFilter
? _activeFilter.type === "itemType"
? _items.filter((i) => i.item_type === _activeFilter.value)
: _items.filter((i) => i.folder_id === _activeFilter.value)
const pool = !_activeFilter
? _items
: _activeFilter.type === "itemType"
? _items.filter((i) => i.item_type === _activeFilter.value)
: _activeFilter.type === "folder"
? _items.filter((i) => i.folder_id === _activeFilter.value)
: _activeFilter.type === "tag"
? _items.filter((i) =>
(i.plain?.tags || []).includes(_activeFilter.value),
)
: _items;
renderItemList(
pool.filter(