Skip to content

Commit

Permalink
Changed the addons hash file extension to .hash.gz
Browse files Browse the repository at this point in the history
  • Loading branch information
kabachuha committed Oct 15, 2020
1 parent 0e74a3b commit 065623f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/server/campaignd/server.cpp
Expand Up @@ -276,7 +276,7 @@ void server::load_config()
campaign_file.commit();
}
{
filesystem::atomic_commit campaign_hash_file(addon_file + "/" + version_cfg["filename"].str() + ".hash");
filesystem::atomic_commit campaign_hash_file(addon_file + "/full_pack_" + file_hash + ".hash.gz");
config_writer writer(*campaign_hash_file.ostream(), true, compress_level_);
config data_hash = config("name", "");
write_hashlist(data_hash, data);
Expand Down Expand Up @@ -907,7 +907,9 @@ void server::handle_request_campaign_hash(const server::request& req)
}
}

filename += ".hash";
//The filename should not contain any dots before the .gz extension mark by design
filename.erase(filename.find_first_of('.') + 1, std::string::npos);
filename += ".hash.gz";
int file_size = filesystem::file_size(filename);

if(file_size < 0) {
Expand Down Expand Up @@ -1262,7 +1264,7 @@ void server::handle_upload(const server::request& req)
}
// Let's write its hashes
{
filesystem::atomic_commit campaign_hash_file(filename + "/" + version_cfg["filename"].str() + ".hash");
filesystem::atomic_commit campaign_hash_file(filename + "/full_pack_" + file_hash + ".hash.gz");
config_writer writer(*campaign_hash_file.ostream(), true, compress_level_);
config data_hash = config("name", "");
write_hashlist(data_hash, data);
Expand Down

0 comments on commit 065623f

Please sign in to comment.