Commit cffb5c73 authored by Kamil Trzciński's avatar Kamil Trzciński 🔴

[extract] Create all directories when extracting ZIP files

parent 852a337d
v 1.0.1
- Use nice log formatting for command line tools
- Don't ask for services during registration (we prefer the .gitlab-ci.yml)
- Create all directories when extracting the file
v 1.0.0
- Add `gitlab-runner exec` command to easy running builds
- Add `gitlab-runner status` command to easy check the status of the service
......
......@@ -53,9 +53,12 @@ func (c *ExtractCommand) extractFile(file *zip.File) (err error) {
fi := file.FileInfo()
// Create all parents to extract the file
os.MkdirAll(filepath.Dir(file.Name), 0777)
switch file.Mode() & os.ModeType {
case os.ModeDir:
err = os.MkdirAll(file.Name, fi.Mode().Perm())
err = os.Mkdir(file.Name, fi.Mode().Perm())
case os.ModeSymlink:
var data []byte
......@@ -77,7 +80,6 @@ func (c *ExtractCommand) extractFile(file *zip.File) (err error) {
in, err := file.Open()
if err == nil {
defer in.Close()
os.MkdirAll(filepath.Dir(file.Name), 0777)
out, err = os.OpenFile(file.Name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode().Perm())
}
if err == nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment