campeon23 / split-fetcher

The code is a concurrent file downloader in Go that splits a file into multiple parts, downloads them in parallel, and assembles the final file, with support for Etag validation to ensure file integrity.
MIT License
1 stars 0 forks source link

Incorrect Logic When Deciding to Decrypt Manifest in run() Function #107

Closed campeon23 closed 1 year ago

campeon23 commented 1 year ago
  • Package/File: main.go
  • Function: run()
  • Line Code: 150

Description:

While reviewing the logic in the run() function, I discovered that we are checking the enablePprof flag to decide whether to proceed with decrypting the manifest. This logic is flawed, as the decision to start the pprof server should be entirely independent of whether we decrypt the manifest.

What should be the correct determining factor is the keepParts flag. If we're keeping the part files, then we'll need to decrypt the manifest because it's essential for assembling the files later.

Recommended Solution:

Remove the condition that checks for enablePprof. Replace it with a condition that checks if keepParts is true. If keepParts is true, proceed to decrypt the manifest. This correction will ensure that we are making the decision to decrypt the manifest based on the correct conditions and not on unrelated flags.

Priority: Medium

campeon23 commented 1 year ago

Based on the feedback provided:

With these changes, the logic flaw has been rectified, ensuring the manifest decryption is based on the right conditions and not unrelated flags.

Given the above corrections, I'm marking this ticket as Closed. Should there be any further concerns or suggestions, please feel free to reopen.

Thank you for the thorough review and pointing out this crucial discrepancy in our logic.