We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 88fdff6 commit 13c6df6Copy full SHA for 13c6df6
1 file changed
src/hermes_clipper/main.py
@@ -336,10 +336,15 @@ def sanitize_filename(title):
336
337
def check_duplicate(url, vault):
338
if not url or not vault: return None
339
+ clippings_dir = os.path.join(vault, "Clippings")
340
+ if not os.path.exists(clippings_dir):
341
+ return None
342
try:
343
patterns = [f"source: {url}", f'source: "{url}"']
344
for pattern in patterns:
- cmd = ["grep", "-rl", pattern, vault]
345
+ # Use fixed strings (-F) for URL search to avoid regex issues
346
+ # Only search within Clippings directory to avoid false positives
347
+ cmd = ["grep", "-rlF", pattern, clippings_dir]
348
result = subprocess.run(cmd, capture_output=True, text=True)
349
if result.returncode == 0 and result.stdout.strip():
350
return result.stdout.splitlines()[0]
0 commit comments