Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle zero chunk size #263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Handle zero chunk size #263

wants to merge 1 commit into from

Commits on Sep 18, 2024

  1. Handle zero chunk size

    The existing implementation of the method
    getChunkSize(...) (uint64, error), in some cases,
    can return chunkSize==0 and err==nil.
    
    The onus is on the caller to check for such possibility
    and handle it properly.
    Callers often use the returned chunkSize as a divisor and
    a zero chunkSize lead to panic.
    see #209
    
    This PR intends to update the method implementation to
    always return an error in case the returned chunkSize
    value is 0.
    That way caller need to only worry about error being non-nil.
    
    Callers which are ok with 0 chunkSize can check the returned
    error against ErrChunkSizeZero
    moshaad7 committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    3268000 View commit details
    Browse the repository at this point in the history