h
This commit is contained in:
@@ -372,6 +372,7 @@ class Folder(Store):
|
||||
tag: Optional list of tag values to add
|
||||
url: Optional list of url to associate with the file
|
||||
title: Optional title (will be added as 'title:value' tag)
|
||||
file_hash: Optional pre-calculated SHA256 hash (skips re-hashing)
|
||||
|
||||
Returns:
|
||||
File hash (SHA256 hex string) as identifier
|
||||
@@ -380,6 +381,7 @@ class Folder(Store):
|
||||
tag_list = kwargs.get("tag", [])
|
||||
url = kwargs.get("url", [])
|
||||
title = kwargs.get("title")
|
||||
file_hash = kwargs.get("file_hash")
|
||||
|
||||
# Extract title from tags if not explicitly provided
|
||||
if not title:
|
||||
@@ -400,7 +402,10 @@ class Folder(Store):
|
||||
tag_list = [title_tag] + list(tag_list)
|
||||
|
||||
try:
|
||||
file_hash = sha256_file(file_path)
|
||||
if not file_hash or len(str(file_hash)) != 64:
|
||||
debug(f"[folder] Re-hashing file: {file_path}", file=sys.stderr)
|
||||
file_hash = sha256_file(file_path)
|
||||
|
||||
debug(f"File hash: {file_hash}", file=sys.stderr)
|
||||
|
||||
# Preserve extension in the stored filename
|
||||
|
||||
Reference in New Issue
Block a user