@@ -329,7 +329,7 @@ func PullStackByMediaTypesFromRegistry(registry string, stack string, allowedMed
329
329
// Decompress archive.tar
330
330
archivePath := filepath .Join (destDir , "archive.tar" )
331
331
if _ , err := os .Stat (archivePath ); err == nil {
332
- err := decompress (destDir , archivePath )
332
+ err := decompress (destDir , archivePath , [] string { "OWNERS" } )
333
333
if err != nil {
334
334
return err
335
335
}
@@ -349,7 +349,7 @@ func PullStackFromRegistry(registry string, stack string, destDir string, option
349
349
}
350
350
351
351
// decompress extracts the archive file
352
- func decompress (targetDir string , tarFile string ) error {
352
+ func decompress (targetDir string , tarFile string , excludeFiles [] string ) error {
353
353
reader , err := os .Open (tarFile )
354
354
if err != nil {
355
355
return err
@@ -370,6 +370,9 @@ func decompress(targetDir string, tarFile string) error {
370
370
} else if err != nil {
371
371
return err
372
372
}
373
+ if isExcluded (header .Name , excludeFiles ) {
374
+ continue
375
+ }
373
376
374
377
target := path .Join (targetDir , header .Name )
375
378
switch header .Typeflag {
@@ -396,6 +399,16 @@ func decompress(targetDir string, tarFile string) error {
396
399
return nil
397
400
}
398
401
402
+ func isExcluded (name string , excludeFiles []string ) bool {
403
+ basename := filepath .Base (name )
404
+ for _ , excludeFile := range excludeFiles {
405
+ if basename == excludeFile {
406
+ return true
407
+ }
408
+ }
409
+ return false
410
+ }
411
+
399
412
//setHeaders sets the request headers
400
413
func setHeaders (headers * http.Header , options RegistryOptions ) {
401
414
t := options .Telemetry
0 commit comments