d
This commit is contained in:
@@ -2002,18 +2002,26 @@ class Folder(Store):
|
||||
if not self._location:
|
||||
return False
|
||||
file_hash = str(file_identifier or "").strip().lower()
|
||||
note_name = str(name or "").strip()
|
||||
if not _normalize_hash(file_hash):
|
||||
return False
|
||||
|
||||
file_path = self.get_file(file_hash, **kwargs)
|
||||
if not file_path or not isinstance(file_path,
|
||||
Path) or not file_path.exists():
|
||||
if not note_name:
|
||||
return False
|
||||
|
||||
with API_folder_store(Path(self._location)) as db:
|
||||
setter_hash = getattr(db, "set_note_by_hash", None)
|
||||
if callable(setter_hash):
|
||||
setter_hash(file_hash, note_name, str(text))
|
||||
return True
|
||||
|
||||
file_path = self.get_file(file_hash, **kwargs)
|
||||
if not file_path or not isinstance(file_path,
|
||||
Path) or not file_path.exists():
|
||||
return False
|
||||
|
||||
setter = getattr(db, "set_note", None)
|
||||
if callable(setter):
|
||||
setter(file_path, str(name), str(text))
|
||||
setter(file_path, note_name, str(text))
|
||||
return True
|
||||
db.save_note(file_path, str(text))
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user