-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Changed Content-Disposition header to download Contact Photo with correct extension #21945
Conversation
I made some changes using the suggestions. As this is a "good first issue," I chose this to get some practice and learn some more :) So let me know if there is something to change/more to do. Also, I noticed the PHP Code-Standards check failed, but am having a little trouble understanding where specifically the error is. Thank you! |
@jneplokh please also rebase and squash your commits into one :) |
84ea799
to
aba247e
Compare
There is a failure on the carddav integration test The two other failures are false positive :) |
Ok, I fixed the error on the carddav integration test by changing the expected header. To clarify, those 3 other failures ( Also, looking at the drone page, |
4dc69a2
to
23dc6f6
Compare
This seems related though |
Hmm, true. Maybe something with not getting the full mimetype but just the extension. I'll see what is going on there. |
Hey, Sorry for the late comment here, got busy with something for a few weeks. I went over the PHPUnit docs, but I am honestly lost on what to change in the test. I got some great help from the Contacts channel, but am still confused on how to make the test work with the changes. What should the next course of action be? If it is closing the PR, I understand. Thank you for all the help, though, during this PR! |
No no! :) Look at the line of the test server/apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php Lines 177 to 182 in 2a054e6
Since you changed the headers, the unit tests needs to reflect those changes too :) |
Awesome!
Ok yeah, I thought this was happening but was not exactly sure where to change it. Thanks for the testing command too. I'll keep working on it :) |
Ok, I just pushed changes which update the headers with a Also, are those two failures false positives? |
- Make ALLOWED_CONTENT_TYPES public in order to use - Add $fileName variable which uses "$node->getName()" to get the proper file name and "$file->getMimeType()" along with the ALLOWED_CONTENT_TYPES array in PhotoCache.php to get the proper file extension - Make "$fileName" the name of the file in the Content-Disposition header when downloading a Contact's photo - Add filename to the CardDAV integration image export test header - Change headers in ImageExportPluginTest to reflect changes Signed-off-by: Jacob Neplokh <me@jacobneplokh.com>
23dc6f6
to
e8a4feb
Compare
🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 32690: failuremariadb10.4-php7.3Show full log
mysql5.6-php7.2Show full log
|
Looks like it :) |
Awesome! So is it effectively ready to be merged? |
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
Thank you @jneplokh !! |
No problem! Definitely learned, too. And thanks for the help during it! :) |
Now prompts to download as ContactPhoto.png cross-browser
Signed-off-by: Jacob Neplokh me@jacobneplokh.com
--
Fixes #20143
@jancborchardt @skjnldsv
The
Content-Disposition
header now also has the file name (set toContactPhoto.png
— if this needs to be changed, let me know) to make sure it is downloaded with the correct file extension, and across browsers.