File encryption external storage fixes

Some performance improvements if files from external storages get shared.