|
@@ -212,6 +212,15 @@ func raiseError(logfile string, uuid string, errMsg string) {
|
|
|
panic("ERROR. " + errMsg)
|
|
|
}
|
|
|
|
|
|
+func ChmodR(path string) error {
|
|
|
+ return filepath.Walk(path, func(name string, info os.FileInfo, err error) error {
|
|
|
+ if err == nil {
|
|
|
+ err = os.Chmod(name, 0755)
|
|
|
+ }
|
|
|
+ return err
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
func main() {
|
|
|
//Init the log folder if it doesn't exists
|
|
|
if !file_exists("log/") {
|
|
@@ -283,6 +292,7 @@ func main() {
|
|
|
raiseError(logfile, uuid, "Output file already exists.")
|
|
|
}
|
|
|
compress(inpath, outpath)
|
|
|
+ os.Chmod(outpath, 0777)
|
|
|
finishFileOperation(logfile, uuid)
|
|
|
} else if command[0] == "unzip" {
|
|
|
//Unzip a given filepath
|
|
@@ -307,6 +317,11 @@ func main() {
|
|
|
}
|
|
|
|
|
|
unzip(inpath, outpath)
|
|
|
+ if isDir(outpath) {
|
|
|
+ ChmodR(outpath)
|
|
|
+ } else {
|
|
|
+ os.Chmod(outpath, 0755)
|
|
|
+ }
|
|
|
finishFileOperation(logfile, uuid)
|
|
|
}
|
|
|
|