- Added DuplicatesService for background duplicate analysis and similarity detection. - Introduced endpoints for analyzing duplicates, checking status, and merging tags. - Created utility functions for file hashing and perceptual hashing. - Implemented watcher settings for runtime tuning of debounce and deduplication. - Added database maintenance tools for resetting and deleting the database. - Enhanced error handling with sanitization for client responses. - Added tests for duplicates service and error handling. - Updated ESLint configuration for better code quality checks. - Introduced filename validation and logging utilities.
14 lines
513 B
Python
14 lines
513 B
Python
from backend.shared import sanitize_error_message
|
|
|
|
|
|
def test_sanitize_error_message_masks_paths() -> None:
|
|
msg = sanitize_error_message(RuntimeError("Failed at C:\\\\secret\\\\file.png"), "Generic error")
|
|
assert "[path]" in msg
|
|
assert "C:\\\\" not in msg
|
|
assert msg.startswith("Generic error:")
|
|
|
|
|
|
def test_sanitize_error_message_returns_fallback_for_empty() -> None:
|
|
assert sanitize_error_message("", "Fallback") == "Fallback"
|
|
assert sanitize_error_message(None, "Fallback") == "Fallback"
|