diff --git a/commands.cpp b/commands.cpp index 6b3c498..9df8406 100644 --- a/commands.cpp +++ b/commands.cpp @@ -677,10 +677,12 @@ static bool decrypt_repo_keys (std::vector& key_files, uint32_t key_ve static void encrypt_repo_key (const char* key_name, const Key_file::Entry& key, const std::vector >& collab_keys, const std::string& keys_path, std::vector* new_files) { + if (!key_name) + key_name = "default"; std::string key_file_data; { Key_file this_version_key_file; - this_version_key_file.set_key_name(key_name); + this_version_key_file.set_key_name(std::strcmp(key_name, "default") != 0 ? key_name : nullptr); this_version_key_file.add(key); key_file_data = this_version_key_file.store_to_string(); } @@ -689,7 +691,7 @@ static void encrypt_repo_key (const char* key_name, const Key_file::Entry& key, const std::string& fingerprint(collab->first); const bool key_is_trusted(collab->second); std::ostringstream path_builder; - path_builder << keys_path << '/' << (key_name ? key_name : "default") << '/' << key.version << '/' << fingerprint << ".gpg"; + path_builder << keys_path << '/' << key_name << '/' << key.version << '/' << fingerprint << ".gpg"; std::string path(path_builder.str()); if (access(path.c_str(), F_OK) == 0) {