LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.42k stars 303 forks source link

Error 500 when downloading an image with non-ASCII characters #1452

Closed gilfu closed 2 years ago

gilfu commented 2 years ago

Detailed description of the problem

When downloading an image with non-ASCII characters in its original filename, server fails with an error 500 HttpException "Symfony's response component failed".

Upload of the file via the import button was perfectly fine. Same for display. Internally, the file was renamed to a UUID filename.

Note that downloading full album is ok, the downloaded zip contains images named with non-ASCII characters.

Steps to reproduce the issue

  1. Upload an image with non-ASCII characters in its filename. Here it was "Connecté.png"
  2. Go to this image in gallery
  3. Click on three-dot menu > Download
  4. Pick any size
  5. Server error 500 HttpException "Symfony's response component failed".

Log outputs

2022-08-08 19:12:27 UTC -- error   -- Symfony\Component\HttpFoundation\HeaderUtils::makeDisposition -- 173 -- The filename fallback must only contain ASCII characters.
2022-08-08 19:12:27 UTC -- error   -- App\Actions\Photo\Archive::file -- 143 -- The filename fallback must only contain ASCII characters.; caused by
2022-08-08 19:12:27 UTC -- error   -- App\Actions\Photo\Archive::file -- 166 -- Symfony's response component failed; caused by

Output of the diagnostics


    Diagnostics
    -------
    Warning: /home/xxx/Lychee/public/uploads/ has permissions 0775, but should have 2775
    Warning: /home/xxx/Lychee/public/uploads/thumb2x has permissions 0775, but should have 2775
    Warning: /home/xxx/Lychee/public/uploads/thumb2x/e3 has permissions 0775, but should have 2775
    Warning: /home/xxx/Lychee/public/uploads/thumb2x/e3/7c has permissions 0775, but should have 2775
    Warning: /home/xxx/Lychee/public/uploads/thumb2x/e3/ea has permissions 0775, but should have 2775
    Warning: 7591 more directories with wrong permissions
    Warning: Dropbox import not working. dropbox_key is empty.
    Info: Latest version of PHP is 8.1
    Warning: Default timezone not properly set; you might experience strange results when importing photos without explicit EXIF timezone

    System Information
    --------------
    Lychee Version (git):            master (fe173e4) -- Up to date (7 hours ago).
    DB Version:                      4.5.3

    composer install:                --no-dev
    APP_ENV:                         production
    APP_DEBUG:                       false

    System:                          Linux
    PHP Version:                     8.0.21
    PHP User agent:                  Lychee/4 (https://lycheeorg.github.io/)
    Timezone:                        UTC
    Max uploaded file size:          500M
    Max post size:                   500M
    Max execution time:              14400
    MySQL Version:                   10.5.16-MariaDB-cll-lve

    exec() Available:                yes
    Imagick Available:               1
    Imagick Enabled:                 1
    Imagick Version:                 1808
    GD Version:                      2.2.5

    Config Information
    --------------
    version:                         040503
    check_for_updates:               0
    sorting_photos_col:              taken_at
    sorting_photos_order:            ASC
    sorting_albums_col:              title
    sorting_albums_order:            ASC
    imagick:                         1
    skip_duplicates:                 1
    small_max_width:                 0
    small_max_height:                360
    medium_max_width:                1920
    medium_max_height:               1080
    lang:                            fr
    layout:                          1
    image_overlay_type:              desc
    default_license:                 none
    compression_quality:             90
    full_photo:                      1
    delete_imported:                 0
    Mod_Frame:                       1
    Mod_Frame_refresh:               30
    thumb_2x:                        1
    small_2x:                        1
    medium_2x:                       1
    landing_page_enable:             0
    landing_owner:                   xxxx
    landing_title:                   
    landing_subtitle:                
    landing_facebook:                
    landing_flickr:                  
    landing_twitter:                 
    landing_instagram:               
    landing_youtube:                 
    landing_background:              
    site_title:                      xxx
    site_copyright_enable:           1
    site_copyright_begin:            2022
    site_copyright_end:              2022
    additional_footer_text:          
    display_social_in_gallery:       0
    public_search:                   0
    SL_enable:                       0
    SL_for_admin:                    0
    public_recent:                   0
    recent_age:                      1
    public_starred:                  0
    downloadable:                    1
    photos_wraparound:               1
    map_display:                     0
    zip64:                           1
    map_display_public:              0
    map_provider:                    Wikimedia
    force_32bit_ids:                 0
    map_include_subalbums:           0
    update_check_every_days:         3
    has_exiftool:                    0
    share_button_visible:            0
    import_via_symlink:              0
    has_ffmpeg:                      0
    location_decoding:               0
    location_decoding_timeout:       30
    location_show:                   1
    location_show_public:            0
    rss_enable:                      0
    rss_recent_days:                 7
    rss_max_items:                   100
    prefer_available_xmp_metadata:   0
    editor_enabled:                  1
    lossless_optimization:           0
    swipe_tolerance_x:               150
    swipe_tolerance_y:               250
    local_takestamp_video_formats:   .avi|.mov
    log_max_num_line:                1000
    unlock_password_photos_with_url_param: 0
    nsfw_visible:                    1
    nsfw_blur:                       0
    nsfw_warning:                    0
    nsfw_warning_admin:              0
    map_display_direction:           1
    album_subtitle_type:             oldstyle
    upload_processing_limit:         2
    public_photos_hidden:            1
    new_photos_notification:         0
    legacy_id_redirection:           1
    zip_deflate_level:               -1

Browser and system

Firefox 103 on Windows 11

nagmat84 commented 2 years ago

I haven't tried it yet myself (so no confirmation) but it sounds highly plausible. Unfortunately, I probably won't have much time the next three days to look into it.

kamil4 commented 2 years ago

This also appears to be a regression. A simple test like that works fine with 4.4.0.

kamil4 commented 2 years ago

I had a strange feeling of deja vu about this report and then I remembered #384. So it's an easy fix. Stay tuned.