Don't drop fully uploaded partial secure location.
This commit is contained in:
parent
897a4e26a7
commit
209dd8b41b
@ -122,6 +122,9 @@ void FileLoader::start_up() {
|
||||
// locaiton untouched. This is completely possible at this point, but probably should be fixed.
|
||||
auto status =
|
||||
parts_manager_.init(size, expected_size, is_size_final, part_size, ready_parts, use_part_count_limit, is_upload);
|
||||
LOG(DEBUG) << "Start " << (is_upload ? "up" : "down") << "load of a file of size " << size << " with expected "
|
||||
<< (is_size_final ? "exact" : "approximate") << " size " << expected_size << ", part size " << part_size
|
||||
<< " and " << ready_parts << " ready parts: " << status;
|
||||
if (status.is_error()) {
|
||||
on_error(std::move(status));
|
||||
stop_flag_ = true;
|
||||
|
@ -40,7 +40,8 @@ FileUploader::FileUploader(const LocalFileLocation &local, const RemoteFileLocat
|
||||
iv_ = encryption_key_.mutable_iv();
|
||||
generate_iv_ = encryption_key_.iv_slice().str();
|
||||
}
|
||||
if (remote_.type() == RemoteFileLocation::Type::Partial && encryption_key_.is_secure()) {
|
||||
if (remote_.type() == RemoteFileLocation::Type::Partial && encryption_key_.is_secure() &&
|
||||
remote_.partial().part_count_ != remote_.partial().ready_part_count_) {
|
||||
remote_ = RemoteFileLocation{};
|
||||
}
|
||||
}
|
||||
@ -80,6 +81,7 @@ Result<FileLoader::FileInfo> FileUploader::init() {
|
||||
parts.push_back(i);
|
||||
}
|
||||
}
|
||||
LOG(DEBUG) << "Init file uploader for " << remote_ << " with offset = " << offset << " and part size = " << part_size;
|
||||
if (!ok.empty() && !ok[0]) {
|
||||
parts.clear();
|
||||
}
|
||||
@ -134,7 +136,7 @@ Result<FileLoader::PrefixInfo> FileUploader::on_update_local_location(const Loca
|
||||
file_type_ = file_type;
|
||||
|
||||
bool is_temp = false;
|
||||
if (encryption_key_.is_secure() && local_is_ready) {
|
||||
if (encryption_key_.is_secure() && local_is_ready && remote_.type() == RemoteFileLocation::Type::Empty) {
|
||||
TRY_RESULT(file_fd_path, open_temp_file(FileType::Temp));
|
||||
file_fd_path.first.close();
|
||||
auto new_path = std::move(file_fd_path.second);
|
||||
|
Loading…
Reference in New Issue
Block a user