This repository was archived by the owner on Apr 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +17
-2
lines changed Expand file tree Collapse file tree 5 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -100,22 +100,24 @@ exports.pack = function (cwd, opts) {
100
100
gid : stat . gid
101
101
}
102
102
103
- header = map ( header ) || header
104
-
105
103
if ( stat . isDirectory ( ) ) {
106
104
header . size = 0
107
105
header . type = 'directory'
106
+ header = map ( header ) || header
108
107
return pack . entry ( header , onnextentry )
109
108
}
110
109
111
110
if ( stat . isSymbolicLink ( ) ) {
112
111
header . size = 0
113
112
header . type = 'symlink'
113
+ header = map ( header ) || header
114
114
return onlink ( filename , header )
115
115
}
116
116
117
117
// TODO: add fifo etc...
118
118
119
+ header = map ( header ) || header
120
+
119
121
if ( ! stat . isFile ( ) ) {
120
122
if ( strict ) return pack . destroy ( new Error ( 'unsupported type for ' + filename ) )
121
123
return onnextentry ( )
Original file line number Diff line number Diff line change
1
+ symlink
Original file line number Diff line number Diff line change @@ -213,3 +213,15 @@ test('specific entries', function (t) {
213
213
t . same ( subDir , [ 'file5' ] )
214
214
} )
215
215
} )
216
+
217
+ test ( 'check type while mapping header on packing' , function ( t ) {
218
+ t . plan ( 3 )
219
+
220
+ var e = path . join ( __dirname , 'fixtures' , 'e' )
221
+
222
+ var checkHeaderType = function ( header ) {
223
+ if ( header . name . indexOf ( '.' ) === - 1 ) t . same ( header . type , header . name )
224
+ }
225
+
226
+ tar . pack ( e , { map : checkHeaderType } )
227
+ } )
You can’t perform that action at this time.
0 commit comments