While working on the thumbnails support, I encountered this very weird bug and can't cope with it. Here are steps to reproduce it at my laptop:
1. Prepare a checkout of Marina's branch https://github.com/marinaglancy/moodle/compare/master...wip-MDL-31901-master
2. Apply the following trivial patch:
As you can see, all the patch does is that it forces to use the full-sized image as the icon and the thumbnail.
3. Create a Folder resource instance.
4. Edit the folder contents and upload a single image to it.
5. TEST: The image is used as the 90x90 "thumbnail" (not real thumbnail as it loads the full image but that does not matter now)
6. Click "View as list" button
Expected behavior: the image resized to 16x16 "thumbnail" is displayed next to the filename and I can save the Folder contents
What actually happens: Just after clicking the button, the session is terminated and you are logged out!
Analysis: somehow, loading draftfile.php from the list view terminates the session. The weird thing is that the 90x90 "thumbnail" image is correctly loaded at the first page via the very same URL and then it does not cases session terminus (in other words, unless you click the "View as list" button, you can safely work with the files).