1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-07-21 18:55:36 +02:00

fix(frontend): guard handleArchive against Enter-key bypass of disabled state

The Archive button is disabled when anyConflict || anyProbing, but
onKeyDown on the locator input calls onSubmit() → handleArchive()
directly, bypassing the button's disabled check entirely.

Add the same conditions as early returns inside handleArchive itself,
operating on toSubmit (the items that would actually be submitted) so
the guard is tight — items with no locator are already excluded by the
toSubmit filter.
This commit is contained in:
TheGeneralist 2026-07-20 22:51:39 +02:00
parent 6eef53ee3a
commit f096b052ab
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4
3 changed files with 13 additions and 11 deletions

View file

@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Archivr</title>
<script type="module" crossorigin src="/assets/index-C35zoxdh.js"></script>
<script type="module" crossorigin src="/assets/index-CChk7xCp.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-vCRGeW0A.css">
</head>
<body>

View file

@ -382,6 +382,8 @@ export default function CaptureDialog({ open, archiveId, onClose, onCaptured, on
function handleArchive() {
const toSubmit = items.filter(it => it.locator.trim())
if (toSubmit.length === 0) return
if (toSubmit.some(it => hasConflict(it))) return
if (toSubmit.some(it => it.playlistProbeState === 'probing' || it.probeState === 'probing')) return
const batchId = toSubmit.length > 1
? (crypto.randomUUID?.() ?? `batch-${Date.now()}`)
: null