forked from mtusi2026/mtusi2026lab4
feat: two-store reconciler with safe repair and cost measurement (grade 5, track 2)
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
_ "image/png"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
@@ -159,7 +160,10 @@ func acquire(ctx context.Context, sem chan struct{}) error {
|
||||
func release(sem chan struct{}) { <-sem }
|
||||
|
||||
func checkFilename(filename string) error {
|
||||
if n := utf8.RuneCountInString(filename); n < 1 || n > maxFilenameRunes {
|
||||
if strings.TrimSpace(filename) == "" {
|
||||
return fmt.Errorf("%w: filename must not be blank", domain.ErrInvalidInput)
|
||||
}
|
||||
if n := utf8.RuneCountInString(filename); n > maxFilenameRunes {
|
||||
return fmt.Errorf("%w: filename must be 1 to 255 characters", domain.ErrInvalidInput)
|
||||
}
|
||||
for _, r := range filename {
|
||||
|
||||
Reference in New Issue
Block a user