[master] Fixed for public link page

Fixed JS issues and preview.

To test:
- [x] Open a shared link to a folder that has a subfolder. Nav into the subfolder. Upload there. Refresh.
- [x] Open shared link to folder: no JS errors
- [x] Open shared link to file: preview appears, no JS errors
- [x] Open shared link to folder: Download file by clicking on the "Download" action: works now

Please review  @MorrisJobke @DeepDiver1975 @schiesbn