mafintosh / tar-stream

tar-stream is a streaming tar parser and generator.
MIT License
400 stars 93 forks source link

Leading slash is removed on long paths #127

Closed lal12 closed 1 year ago

lal12 commented 3 years ago

I noticed that tar-stream removes the leading slash on long paths.

The problem is the splitting into name and prefix in headers.js. There a leading slash is dropped, because of line 208 where essentially prefix = '' + name.slice(0,0) is called which still is an empty string, but the first char is also dropped in name name = name.slice(0 + 1)

I can do a PR, just wanted to know if there is any specific reason for this or if it is just a bug.

clarkttfu commented 3 years ago

@lal12 comment appreciated, I added a line before line 208: if (i === 0) i = name.indexOf('/', 1) // reindex for next slash