diff options
author | Ollie Phillips <oliver@eantics.co.uk> | 2019-03-26 22:55:36 +0000 |
---|---|---|
committer | Ollie Phillips <oliver@eantics.co.uk> | 2019-03-26 22:55:36 +0000 |
commit | d207c7d0f01bf3debd7b675dec0cf9243dac8a2e (patch) | |
tree | 320ab1e01086bd346c6fb6d5f8a74fe6ffdd5823 | |
parent | 9348a3e6cd0a1e2b0cd6611b1f7acb04307544e7 (diff) |
avoid feeding filepath.Join panicable slice
-rw-r--r-- | system/admin/filesystem.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/system/admin/filesystem.go b/system/admin/filesystem.go index e556ec8..758966b 100644 --- a/system/admin/filesystem.go +++ b/system/admin/filesystem.go @@ -26,8 +26,8 @@ func deleteUploadFromDisk(target string) error { // split and rebuild path in OS friendly way // use path to delete the physical file from disk - pathSplit := strings.Split(upload.Path, "/") - pathJoin := filepath.Join(pathSplit[2:]...) + pathSplit := strings.Split(strings.TrimPrefix(upload.Path, "/api/"), "/") + pathJoin := filepath.Join(pathSplit...) err = os.Remove(pathJoin) if err != nil { return err |