Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File-Suffixes duplicated in Downloaded Album #2447

Closed
2 tasks done
ildyria opened this issue May 25, 2024 Discussed in #2440 · 2 comments · Fixed by #2474
Closed
2 tasks done

File-Suffixes duplicated in Downloaded Album #2447

ildyria opened this issue May 25, 2024 Discussed in #2440 · 2 comments · Fixed by #2474
Labels
bug Something isn't working

Comments

@ildyria
Copy link
Member

ildyria commented May 25, 2024

Discussed in #2440

Originally posted by fmaack May 20, 2024

Lychee version

v5.3

Which PHP version are you using?

PHP 8.3

Detailed description of the problem

I am using the "Download Album"-Feature which creates a zip-file containing all the images.

The filenames of the images inside the zip-file contains the filetype two times.

Steps to reproduce the issue

  1. upload an image IMG_123.jpeg into an album.
  2. use the "Download Album" Button.
  3. unpack the zip-File.

Result: The downloaded filename ist IMG_123.jpeg.jpeg.

Diagnostics [REQUIRED]

No response

Browser & System [REQUIRED]

No response

Please confirm (incomplete submissions will not be addressed)

  • I have provided easy and step-by-step instructions to reproduce the bug.
  • I understand my bug report will be removed if I haven't met the criteria above.
@trailfog
Copy link

I wanted to report this bug as well. I might have a few additional things to add, however:

  • This also happens if you download a single image in the original size.
  • This does not happen with images, that have been downsized during the import.
  • This only happens, when the image was uploaded using the new, v5 layout.
    • When uploading the image using the v5 layout, the full filename + extension is used as the images "title". The old layout did not save the extension in the title.
    • When uploading an image with the v5 and switching back to the old layout, the same issue arises with the extension being added twice when downloading the image uploaded with the v5 interface.

Thus, I believe the issue lies with the full filename being saved during the upload, not with the download.

My quick & dirty SQL fix

Running a query, such as the following, will remove the extension from the title and result in the expected filename when downloading.

The extension in the query will have to be adjusted to your use case. Be careful when using this query, as it may delete other information from the title than expected, as it only checks for the presence of ".jpg" (anywhere) in the title and removes the last 4 characters of such titles.

USE AT YOUR OWN RISK!

UPDATE photos SET title = SUBSTRING(title, 1, LENGTH(title) - 4) WHERE title LIKE '%.jpg';

@ildyria
Copy link
Member Author

ildyria commented Jun 21, 2024

@trailfog thank you for your investigations.
It seems indeed that it is the upload with the new front-end that is cause of the problem.
I am not sure whether to drop the extension from the title of an image is a good or a bad thing.

In the mean time, there is this solution: #2474
Opinion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants