MCPcopy Create free account
hub / github.com/exercism/cli / fileSizesWithinMax

Method fileSizesWithinMax

cmd/submit.go:398–416  ·  view source on GitHub ↗

fileSizesWithinMax checks that each file does not exceed the max allowed size.

(submitPaths []string)

Source from the content-addressed store, hash-verified

396
397// fileSizesWithinMax checks that each file does not exceed the max allowed size.
398func (s submitValidator) fileSizesWithinMax(submitPaths []string) error {
399 for _, file := range submitPaths {
400 info, err := os.Stat(file)
401 if err != nil {
402 return err
403 }
404 const maxFileSize int64 = 65535
405 if info.Size() >= maxFileSize {
406 msg := `
407
408 The submitted file '%s' is larger than the max allowed file size of %d bytes.
409 Please reduce the size of the file and try again.
410
411 `
412 return fmt.Errorf(msg, file, maxFileSize)
413 }
414 }
415 return nil
416}
417
418// submissionNotEmpty checks that there is at least one file to submit.
419func (s submitValidator) submissionNotEmpty(docs []workspace.Document) error {

Callers 1

runSubmitFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected