This commit is contained in:
nose
2025-12-05 03:42:57 -08:00
parent 5e4df11dbf
commit 5482ee5586
20 changed files with 911 additions and 223 deletions

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
from typing import Any, Dict, Sequence
import json
import sys
from . import register
import models
@@ -219,6 +220,12 @@ def _process_deletion(tags: list[str], hash_hex: str | None, file_path: str | No
if not tags:
return False
# Safety: block deleting title: without replacement to avoid untitled files
title_tags = [t for t in tags if isinstance(t, str) and t.lower().startswith("title:")]
if title_tags:
log("Cannot delete title: tag without replacement. Use add-tag \"title:new title\" instead.", file=sys.stderr)
return False
if not hash_hex and not file_path:
log("Item does not include a hash or file path")