MCPcopy Create free account
hub / github.com/devld/go-drive / newShellThumbnailTypeHandler

Function newShellThumbnailTypeHandler

server/thumbnail/shell.go:59–79  ·  view source on GitHub ↗
(c types.SM)

Source from the content-addressed store, hash-verified

57}
58
59func newShellThumbnailTypeHandler(c types.SM) (TypeHandler, error) {
60 shell := c["shell"]
61 mimeType := c["mime-type"]
62 writeContent := c.GetBool("write-content")
63 if strings.TrimSpace(shell) == "" {
64 return nil, errors.New("invalid command, you must specify a valid 'shell'")
65 }
66 if mimeType == "" {
67 return nil, errors.New("mime-type must be specified")
68 }
69 command, args := platformShellCommand(runtime.GOOS, shell)
70
71 return &shellThumbnailTypeHandler{
72 command: command,
73 args: args,
74 writeContent: writeContent,
75 maxSize: c.GetInt64("max-size", -1),
76 mimeType: mimeType,
77 timeout: c.GetDuration("timeout", -1),
78 }, nil
79}
80
81func platformShellCommand(goos, script string) (string, []string) {
82 if goos == "windows" {

Callers 1

Calls 4

platformShellCommandFunction · 0.85
GetBoolMethod · 0.80
GetInt64Method · 0.80
GetDurationMethod · 0.80

Tested by 1