Added functionality to clone file permissions when archiving them
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2023-04-16 16:11:07 -04:00
parent fa4e51a0e8
commit 797d6cf1d3

View File

@ -73,6 +73,8 @@ func (r *Repository) ArchiveFile(inFile string) {
log.Fatalf("Error opening file in ingest: %s.", err)
os.Exit(1)
}
sourceStat, _ := source.Stat()
sourceMode := sourceStat.Mode()
defer source.Close()
// attempt to create destination file
@ -82,7 +84,7 @@ func (r *Repository) ArchiveFile(inFile string) {
os.Exit(1)
}
defer destination.Close()
destination.Chmod(0755)
destination.Chmod(sourceMode)
// perform the file copy
_, err = io.Copy(destination, source)