mirror of
https://github.com/gmbrax/Pilgrim.git
synced 2026-11-09 17:20:17 +00:00
Fix the bug that collides the hash if identical images
This commit is contained in:
parent
44ff390695
commit
9e4b08234f
@@ -63,10 +63,16 @@ class AddPhotoModal(Screen):
|
||||
|
||||
async def _async_create_photo(self, photo_data: dict):
|
||||
"""Creates a new photo asynchronously using PhotoService"""
|
||||
|
||||
|
||||
try:
|
||||
service_manager = self.app.service_manager
|
||||
photo_service = service_manager.get_photo_service()
|
||||
|
||||
if photo_service.check_photo_by_hash(photo_service.hash_file(photo_data["filepath"]),self.diary_id):
|
||||
self.notify("Photo already exists in database", severity="error")
|
||||
return
|
||||
|
||||
new_photo = photo_service.create(
|
||||
filepath=Path(photo_data["filepath"]),
|
||||
name=photo_data["name"],
|
||||
|
||||
Reference in New Issue
Block a user