sha1_file: guard against invalid loose subdirectory numbers