Make checksum safe against raw file store save() returning null

This shouldn't change behavior, but do test that importing a file still works and that attaching a file and a non-empty file still works okay and that they can be downloaded intact.

This rebases #1047 and #1121.