Uh oh!
There was an error while loading. Please reload this page.
Changed Content-Disposition header to download Contact Photo with correct extension - #21945
Conversation
Uh oh!
There was an error while loading. Please reload this page.
jacobneplokh
commented
Jul 23, 2020
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! |
Uh oh!
There was an error while loading. Please reload this page.
skjnldsv
commented
Jul 25, 2020
@jneplokh please also rebase and squash your commits into one :) |
84ea799 to
aba247eCompareThere 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
23dc6f6Compareskjnldsv
commented
Jul 27, 2020
This seems related though |
jacobneplokh
commented
Jul 28, 2020
Hmm, true. Maybe something with not getting the full mimetype but just the extension. I'll see what is going on there. |
jacobneplokh
commented
Sep 2, 2020
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! |
skjnldsv
commented
Sep 3, 2020
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 :) |
jacobneplokh
commented
Sep 4, 2020
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
e8a4febCompare🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 32690: failuremariadb10.4-php7.3Show full logmysql5.6-php7.2Show full log |
skjnldsv
commented
Sep 5, 2020
Looks like it :) |
jacobneplokh
commented
Sep 6, 2020
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 |
skjnldsv
commented
Sep 7, 2020
Thank you @jneplokh !! |
jacobneplokh
commented
Sep 7, 2020
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-Dispositionheader 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.