Skip to content

Incorrect slice() from fs.openAsBlob() #53908

Closed
@jleedev

Description

@jleedev

Version

v22.5.0

Platform

Linux penguin 6.6.32-02873-ge0e03a627715 #1 SMP PREEMPT Mon, 1 Jul 2024 20:29:42 +0000 aarch64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

> await fs.promises.writeFile('a.txt', 'abcdefghij')
> blob = await fs.openAsBlob('a.txt')
Blob { size: 10, type: '' }
> await _.text()
'abcdefghij'
> blob.slice(3)
Blob { size: 7, type: '' }
> await _.text()
'defghij'
> blob.slice(3).slice()
Blob { size: 7, type: '' }
> await _.text()
'defg'

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

slice() with no arguments should be equivalent to slice(0, length) and return the entire blob; both of those are incorrectly returning something else.

What do you see instead?

The returned Blob object purports to have the expected size, but when it is read it has the wrong length.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions