Fix preview for shared folder and public upload

please review @butonic @DeepDiver1975 @jancborchardt