Skip to content

Commit 132b212

Browse files
authored
Merge pull request #1439 from 0chain/hotfix/unlock-content
fix unlocking content
2 parents d16854c + f98b0e1 commit 132b212

File tree

1 file changed

+6
-4
lines changed
  • code/go/0chain.net/blobbercore/filestore

1 file changed

+6
-4
lines changed

code/go/0chain.net/blobbercore/filestore/storage.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (fs *FileStore) DeletePreCommitDir(allocID string) error {
185185
return nil
186186
}
187187

188-
func (fs *FileStore) CommitWrite(allocID, conID string, fileData *FileInputData) (bool, error) {
188+
func (fs *FileStore) CommitWrite(allocID, conID string, fileData *FileInputData) (_ bool, err error) {
189189

190190
logging.Logger.Info("Committing write", zap.String("allocation_id", allocID), zap.Any("file_data", fileData))
191191
filePathHash := encryption.Hash(fileData.Path)
@@ -198,7 +198,7 @@ func (fs *FileStore) CommitWrite(allocID, conID string, fileData *FileInputData)
198198

199199
preCommitPath := fs.getPreCommitPathForFile(allocID, fileHash, VERSION)
200200

201-
err := createDirs(filepath.Dir(preCommitPath))
201+
err = createDirs(filepath.Dir(preCommitPath))
202202
if err != nil {
203203
return false, common.NewError("blob_object_precommit_dir_creation_error", err.Error())
204204
}
@@ -288,12 +288,14 @@ func (fs *FileStore) CommitWrite(allocID, conID string, fileData *FileInputData)
288288
validationRoot := hex.EncodeToString(validationRootBytes)
289289
elapsedRoot := time.Since(now) - elapsedWait
290290
if fmtRoot != fileData.FixedMerkleRoot {
291-
return false, common.NewError("fixed_merkle_root_mismatch",
291+
err = common.NewError("fixed_merkle_root_mismatch",
292292
fmt.Sprintf("Expected %s got %s", fileData.FixedMerkleRoot, fmtRoot))
293+
return false, err
293294
}
294295
if validationRoot != fileData.ValidationRoot {
295-
return false, common.NewError("validation_root_mismatch",
296+
err = common.NewError("validation_root_mismatch",
296297
"calculated validation root does not match with client's validation root")
298+
return false, err
297299
}
298300

299301
err = os.Rename(tempFilePath, preCommitPath)

0 commit comments

Comments
 (0)