immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
49.79k stars 2.63k forks source link

Mobile Backup: Files are multiple times uploaded when deleted online #8811

Closed mariusberlinghof closed 6 months ago

mariusberlinghof commented 6 months ago

The bug

When a photo originates from a mobile backup and is deleted online, it will be automatically backed up again as soon as the next backup job is started on the mobile device. This prevents user from deleting images only from the backup target location (immich server).

The OS that Immich Server is running on

22.04.4 LTS

Version of Immich Server

v1.101.0

Version of Immich Mobile App

v1.101.0

Platform with the issue

Your docker-compose.yml content

version: '3.8'

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:release
    # image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: ['start.sh', 'immich']
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    environment:
      LETSENCRYPT_HOST: ${URL}
      VIRTUAL_HOST: ${URL}
      VIRTUAL_PORT: 3001
      DB_PASSWORD: ${DB_PASSWORD}
      DB_DATABASE_NAME: ${DB_DATABASE_NAME}
      DB_HOSTNAME: ${DB_HOSTNAME}
      DB_USERNAME: ${DB_USERNAME}
      REDIS_HOSTNAME: ${REDIS_HOSTNAME}
    depends_on:
      - redis
      - database
    restart: always
    networks:
      - immich-backend
      - net
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:release
    # image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    command: ['start.sh', 'microservices']
    environment:
      DB_PASSWORD: ${DB_PASSWORD}
      DB_HOSTNAME: ${DB_HOSTNAME}
      DB_DATABASE_NAME: ${DB_DATABASE_NAME}
      DB_USERNAME: ${DB_USERNAME}
      REDIS_HOSTNAME: ${REDIS_HOSTNAME}
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - redis
      - database
    restart: always
    networks:
      - immich-backend
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:release
    # image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    ports:
      - 3003:3003
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    restart: always
    networks:
      - immich-backend
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  redis:
    container_name: immich_redis
    image: registry.hub.docker.com/library/redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5
    restart: always
    networks:
      - immich-backend
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  database:
    container_name: immich_postgres
    image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always
    networks:
      - immich-backend
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

volumes:
  pgdata:
  model-cache:

networks:
  net:
    external: true
  immich-backend:

Your .env content

UPLOAD_LOCATION=/data/apps/immich/upload
IMMICH_VERSION=v1.101.0
DB_PASSWORD=REDACTED
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
REDIS_HOSTNAME=immich_redis
URL=REDACTED

Reproduction steps

1. take photo on mobile device
2. enable photo backup
3. delete uploaded photo from website
4. BUG: photo will be uploaded again

Relevant log output

No response

Additional information

Maybe this problem can be solved by caching uploaded image/videos keys on mobile device to prevent duplicate upload on device?

schuhbacca commented 6 months ago

Not a bug, this is how it's currently implemented. I am not sure if I see an exact feature request for this so feel free to open one after looking around. There's also a refactor of the mobile upload process in process currently.

benmccann commented 6 months ago

Duplicate of https://github.com/immich-app/immich/discussions/3594

I would agree that it shouldn't behave this way and we should update the behavior