Use OS-specific path separator for hooks

Fixes https://github.com/tus/tusd/issues/206
This commit is contained in:
Acconut 2018-09-25 13:49:06 +01:00
parent 6a474ce89e
commit 1b756f0239
1 changed files with 2 additions and 1 deletions

View File

@ -146,7 +146,8 @@ func invokeHttpHook(name string, typ HookType, info tusd.FileInfo, captureOutput
} }
func invokeFileHook(name string, typ HookType, info tusd.FileInfo, captureOutput bool) ([]byte, error) { func invokeFileHook(name string, typ HookType, info tusd.FileInfo, captureOutput bool) ([]byte, error) {
cmd := exec.Command(Flags.FileHooksDir + "/" + name) hookPath := Flags.FileHooksDir + string(os.PathSeparator) + name
cmd := exec.Command(hookPath)
env := os.Environ() env := os.Environ()
env = append(env, "TUS_ID="+info.ID) env = append(env, "TUS_ID="+info.ID)
env = append(env, "TUS_SIZE="+strconv.FormatInt(info.Size, 10)) env = append(env, "TUS_SIZE="+strconv.FormatInt(info.Size, 10))