fix: getDriverIcon never checked for a URL/data: manifest icon (#632) - #645
fix: getDriverIcon never checked for a URL/data: manifest icon (#632)#645aesslinger wants to merge 4 commits into
Conversation
RegistryDriverIcon (a generic <img>-with-fallback for a registry-hosted icon URL) lived under src/components/modals/connection/, used only by that folder's two components (EngineCard, InstallGate). Moves it to src/components/ — matching ConnectionIconImage's sibling placement — so src/utils/driverUI.tsx (a general utility, not modal-specific) can reuse it in the next commit without reaching into a single modal's private folder. No behavior change; just updates the two existing importers' relative paths.
…arisDB#632) Every external plugin's icon fell through to the generic Plug icon in 7 of the 8 places the app renders a driver/connection icon, regardless of what its .tabularium icon field was set to — getDriverIcon only ever compared the string against 6 hardcoded literals ("postgres"/"mysql"/"sqlite" for brand SVGs, "network"/"database"/"folder-open" for legacy lucide names), so a URL or data: URI (a documented, valid manifest value) could never match and always fell to the default: Plug case. Only EngineCard.tsx's own separate, duplicated renderIcon (used solely by the "Choose a database" picker) had a working URL check. Adds the same URL/data: check as the first branch in getDriverIcon, using the RegistryDriverIcon component moved in the previous commit. Fixes all 7 affected sites at once, since they all call getDriverIcon/getConnectionIcon. @debba confirmed the intended 3-tier priority on the issue: Connection Custom Icon > Manifest Icon (if present) > Plugin Icon. getConnectionIcon already enforced the outer tier (per-connection appearance.icon override checked before falling back to getDriverIcon); this fix completes the middle tier so it's actually reachable instead of dead code. EngineCard.tsx's own renderIcon is deliberately left untouched beyond its import path (previous commit) — it has its own separate Database fallback for the URL-check branch (vs. getDriverIcon's Plug), and unifying that is a larger behavior change than this issue asks for. Also corrects PluginManifest.icon's doc comment, which only mentioned the 6 literal values and never documented URL/data: URI as valid — even though the Tabularium manifest docs the issue cites already do.
Local verification notesRan a local review pass against Rules compliance — all clean: no Claims independently reproduced, not taken on faith:
One thing noted, not a blocker: found 2 other icon-rendering sites in the codebase not covered by this PR's "8 places" framing — Manual test plan (real data, no synthetic fixture needed — the real
No known blockers. |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of the two follow-up commits ( Files Reviewed (8 files)
Previous Review Summary (commit ebd269c)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit ebd269c)Status: No Issues Found | Recommendation: Merge The fix adds a URL/ Files Reviewed (6 files)
Reviewed by glm-5.2 · Input: 76.1K · Output: 18.1K · Cached: 179.3K |
…Icon URI schemes are case-insensitive per RFC 3986, but every icon URL check (getDriverIcon, EngineCard's renderIcon, InstallGate's renderIcon and NewConnectionModal's renderDriverGlyph) matched them with a case-sensitive regex, so a manifest declaring HTTPS://... fell through to the generic fallback. Extract the check into an exported isUrlIcon helper in driverUI and use it in all four places, removing the duplicated regex.
src/utils/driverUI.test.tsx predated the tests/ convention (testing.md) and left the module with two live test files after TabularisDB#645 added tests/utils/driverUI.test.tsx. Merge its driverUI cases into that file, move its connectionIconPack cases to a new mirrored tests/utils/connectionIconPack.test.tsx, and add coverage for the new isUrlIcon helper. No test cases were dropped.
|
Hi @aesslinger, while reviewing I pushed two small commits on top of your branch:
Both test files pass locally (25/25). Let me know if you agree with the changes, happy to adjust or revert if you'd prefer a different approach. |
Closes #632
Summary
Every external plugin's icon fell through to the generic
Plugicon in 7 of the 8 places the app renders a driver/connection icon, regardless of what its.tabulariumiconfield was set to.getDriverIcon(src/utils/driverUI.tsx) only ever compared the icon string against 6 hardcoded literals — a URL ordata:URI (a documented, valid manifest value per the Tabularium docs) could never match any of them and always fell to the defaultPlugcase. OnlyEngineCard.tsx's own separate, duplicated icon-rendering logic (used solely by the "Choose a database" picker) had a working URL check.Every currently-published external plugin on the registry is affected identically — confirmed in the issue.
Priority order
@debba confirmed the intended 3-tier priority on the issue: Connection Custom Icon > Manifest Icon (if present) > Plugin Icon.
getConnectionIconalready enforced the outer tier (per-connectionappearance.iconoverride checked before falling back togetDriverIcon) — unchanged here.data:icon), which was previously dead code — no manifest value could ever reach it.getDriverIcon's existing literal-string switch, now only reached once the URL check has been ruled out.What changed
Two commits:
refactor: move RegistryDriverIcon out of the connection-modal folder— moves the existing<img>-with-fallback component fromsrc/components/modals/connection/tosrc/components/(matchingConnectionIconImage's sibling placement), so the general-purposedriverUI.tsxcan reuse it without reaching into one modal's private folder. No behavior change, just updates the 2 existing importers.fix: getDriverIcon never checked for a URL/data: manifest icon— adds the URL/data:check as the first branch ingetDriverIcon, fixing all 7 affected call sites at once (they all route throughgetDriverIcon/getConnectionIcon). Also correctsPluginManifest.icon's doc comment, which never documented URL/data:URI as valid values.Explicitly out of scope
EngineCard.tsx's ownrenderIconis left untouched beyond its import path — it has its own separateDatabasefallback for the URL-check branch (vs.getDriverIcon'sPlug), and unifying those two fallbacks is a small but real behavior change beyond what this issue asks for.Verification
pnpm tsc --noEmit— cleanpnpm lint— cleanpnpm vitest run— 3734/3767 (33 pre-existing/unrelated failures — alocalStorage.clear()jsdom gap in this local environment, confirmed present on a clean checkout, unrelated to this change)tests/utils/driverUI.test.tsx(9 tests) covers: URL icon →<img>,data:icon →<img>, literal-string brand/lucide/fallback cases still work unchanged, and the full 3-tier priority order viagetConnectionIcon(connection override beats manifest URL, manifest URL beats built-in fallback)tests/components/connection/EngineCard.test.tsx(3 tests) still pass unchanged