mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-09 07:30:03 +08:00
Added endpoint to list files.
This commit is contained in:
23
pkg/types.go
23
pkg/types.go
@@ -1,6 +1,7 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
|
||||
@@ -103,3 +104,25 @@ type WorkflowExecutionOptions struct {
|
||||
ListOptions *ListOptions
|
||||
PodGCStrategy *PodGCStrategy
|
||||
}
|
||||
|
||||
type File struct {
|
||||
Path string
|
||||
Name string
|
||||
Size int64
|
||||
ContentType string
|
||||
LastModified time.Time
|
||||
Directory bool
|
||||
}
|
||||
|
||||
func FilePathToName(path string) string {
|
||||
if strings.HasSuffix(path, "/") {
|
||||
path = path[:len(path)-1]
|
||||
}
|
||||
|
||||
lastSlashIndex := strings.LastIndex(path, "/")
|
||||
if lastSlashIndex < 0 {
|
||||
return path
|
||||
}
|
||||
|
||||
return path[lastSlashIndex+1:]
|
||||
}
|
||||
|
Reference in New Issue
Block a user