File tree 3 files changed +8
-7
lines changed
3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ const Pack = warner(class Pack extends MiniPass {
129
129
[ ADDTARENTRY ] ( p ) {
130
130
const absolute = path . resolve ( this . cwd , p . path )
131
131
if ( this . prefix )
132
- p . path = this . prefix + '/' + p . path . replace ( / ^ \. \/ * / , '' )
132
+ p . path = this . prefix + '/' + p . path . replace ( / ^ \. ( \/ + | $ ) / , '' )
133
133
134
134
// in this case, we don't have to wait for the stat
135
135
if ( ! this . filter ( p . path , p ) )
@@ -148,7 +148,7 @@ const Pack = warner(class Pack extends MiniPass {
148
148
[ ADDFSENTRY ] ( p ) {
149
149
const absolute = path . resolve ( this . cwd , p )
150
150
if ( this . prefix )
151
- p = this . prefix + '/' + p . replace ( / ^ \. \/ * / , '' )
151
+ p = this . prefix + '/' + p . replace ( / ^ \. ( \/ + | $ ) / , '' )
152
152
153
153
this [ QUEUE ] . push ( new PackJob ( p , absolute ) )
154
154
this [ PROCESS ] ( )
Original file line number Diff line number Diff line change
1
+ .
Original file line number Diff line number Diff line change @@ -90,19 +90,19 @@ t.test('pack a file', t => {
90
90
t . test ( 'pack a file with a prefix' , t => {
91
91
const out = [ ]
92
92
new Pack ( { cwd : files , prefix : 'package/' } )
93
- . end ( 'one-byte.txt ' )
93
+ . end ( '.dotfile ' )
94
94
. on ( 'data' , c => out . push ( c ) )
95
95
. on ( 'end' , _ => {
96
96
const data = Buffer . concat ( out )
97
97
t . equal ( data . length , 2048 )
98
- t . match ( data . slice ( 512 ) . toString ( ) , / ^ a \0 { 511 } \0 { 1024 } $ / )
98
+ t . match ( data . slice ( 512 ) . toString ( ) , / ^ . \n \0 { 510 } \0 { 1024 } $ / )
99
99
const h = new Header ( data )
100
100
const expect = {
101
101
cksumValid : true ,
102
102
needPax : false ,
103
- path : 'package/one-byte.txt ' ,
103
+ path : 'package/.dotfile ' ,
104
104
mode : 0o644 ,
105
- size : 1 ,
105
+ size : 2 ,
106
106
mtime : mtime ,
107
107
cksum : Number ,
108
108
linkpath : '' ,
@@ -117,7 +117,7 @@ t.test('pack a file with a prefix', t => {
117
117
}
118
118
t . match ( h , expect )
119
119
const sync = new PackSync ( { cwd : files , prefix : 'package' } )
120
- . add ( 'one-byte.txt ' ) . end ( ) . read ( )
120
+ . add ( '.dotfile ' ) . end ( ) . read ( )
121
121
t . equal ( sync . slice ( 512 ) . toString ( ) , data . slice ( 512 ) . toString ( ) )
122
122
const hs = new Header ( sync )
123
123
t . match ( hs , expect )
You can’t perform that action at this time.
0 commit comments