-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Provide an ASCII fallback for multibyte filenames #1453
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good. I also compared it with the analogous code for the albums to ensure consistency, i.e.
Lychee/app/Actions/Album/Archive.php
Lines 72 to 76 in fe173e4
$disposition = HeaderUtils::makeDisposition( | |
HeaderUtils::DISPOSITION_ATTACHMENT, | |
$zipTitle . '.zip', | |
mb_check_encoding($zipTitle, 'ASCII') ? '' : 'Album.zip' | |
); |
Let's see, if I find the time to add a test case this evening so that we won't tumble across this regression a third time. Or you can add it. It shouldn't be too difficult. Just upload a photo, rename it to something with multi-byte characters in it and then download it. Optimally, we also add a test for an album, too, while we are on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Strictly speaking, we don't need a new image file with a multi-byte character; we could just upload one of the existing ones and then change the title. But I guess there may be value in testing multi-byte uploads as well... I agree with @nagmat84 that we should also add a test for multi-byte album downloads. |
Looking through the testsuite, I could easily add a relevant album test by adding just a couple of lines to Lychee/tests/Feature/PhotosOperationsTest.php Line 139 in ef102c4
Is that considered acceptable? There's a comment at the start of that method that says: Preferably, all the tested actions should be seperated into individual tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will push some commits myself which address my remarks.
That's what I thought of, too.
Agreed. And as @ildyria has already added a sample file, I'm fine with that. |
I would like to avoid that. When I added a lot of test as part of #1351, I needed to get this "god test" out of my way but did not want to lose what has already been there. In the long run this god test should be split, hence I would prefer not to add to that mess. Let's see if I can create a test this evening. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed all my concerns myself. I also added a test to download an archive with a multi-byte title. Feel free to merge and resolve my remarks. I only left them open for you such that they are more easily to read.
Fixes #1452
An equivalent of an old fix we had implemented for albums in #384