Skip to content

RNFetchBlob.session(...).remove(path) not removing path from session list #885

@varemel

Description

@varemel

Hello,

Thanks for your cool lib. I am really enjoing using it.

Found bug with session remove method. It doesn't remove item from list.

i will be item (=path string) and not index of element. This code will never find item to delete, because list[i] will always be undefined.

for(let i of list) {

  remove(path:string):RNFetchBlobSession {
    let list = sessions[this.name]
    for(let i of list) {
      if(list[i] === path) {
        sessions[this.name].splice(i, 1)
        break;
      }
    }
    return this
  }

Suggest fix

  remove(path:string):ReactNativeBlobUtilSession {
    let list = sessions[this.name];
    for (let i = 0; i < list.length; i++) {
      if (list[i] === path) {
        sessions[this.name].splice(i, 1);
        break;
      }
    }
    return this;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions