immich-app / immich

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

Paste within search form can accidentally upload an image #11882

Closed m3brown closed 1 week ago

m3brown commented 3 weeks ago

The bug

Suppose you believe your OS has copied (i.e. Control-C) text data, but in actuality there is an imagine file copied (e.g. a png file).

When typing content into the search form field, typing Control-V will upload an image. This is confusing because the upload happened when the cursor was focused on a text bos.

The OS that Immich Server is running on

docker-compose stack running on Debian

Version of Immich Server

v1.112.1

Version of Immich Mobile App

Not Applicable

Platform with the issue

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - /srv/dev-disk-by-id-ata-WDC_WD80EMAZ-00WJTA0_JEGJ1LJN-part1/photo:/mnt/photo/cameras:ro

    devices:
      - /dev/dri:/dev/dri  # If using Intel QuickSync or VAAPI
    ports:
      - 2283:3001
    env_file:
      - stack.env
    depends_on:
      - redis
      - database

    # swag integration
    labels:
      - swag=enable
      - swag_url=photos.*
    networks:
      - default
      - swag

    restart: unless-stopped

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - stack.env
    restart: unless-stopped

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine
    restart: unless-stopped

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0
    env_file:
      - stack.env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    restart: unless-stopped

volumes:

  model-cache:

networks:
  swag:
    external: true
    name: swag_default

Your .env content

UPLOAD_LOCATION=/srv/dev-disk-by-id-ata-WDC_WD80EMAZ-00WJTA0_JEGJ1LJN-part1/appdata/immich/upload
IMMICH_VERSION=release
TYPESENSE_API_KEY=<redacted>
DB_PASSWORD=<redacted>
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
REDIS_HOSTNAME=immich_redis
DB_DATA_LOCATION=/srv/dev-disk-by-id-ata-WDC_WD80EMAZ-00WJTA0_JEGJ1LJN-part1/appdata/immich/postgres

Reproduction steps

1. Open Immich in web browser
2. Copy image file (e.g. by clicking the copy button for an image within Immich
3. Go to the immich homepage
4. Click the "show search options" button
5. For search type, click "File name or extension"
6. Click on the "Search by context" text box to begin typing
7. Type Command-V (I'm on a Mac)
8. Observe that toaster dialogs appear in the top right reporting a new file uploaded
9. Observe a new file at the top of the image history, dated with today's date.

Relevant log output

No response

Additional information

Tangentially related comment - it'd be cool if there was a way to disable upload altogether for folks that are using external libraries. From the perspective of this ticket, it would avoid the need to delete the file.

radh21301 commented 3 weeks ago

Maybe another simpler solution would be to disable the upload feature when the search field is clicked (instead of disabling the feature altogether). If you are in the search field, you most certainly would not be pasting/uploading an image.