From d207c7d0f01bf3debd7b675dec0cf9243dac8a2e Mon Sep 17 00:00:00 2001 From: Ollie Phillips Date: Tue, 26 Mar 2019 22:55:36 +0000 Subject: avoid feeding filepath.Join panicable slice --- system/admin/filesystem.go | 4 ++-- 1 file 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 -- cgit v1.2.3