MCPcopy
hub / github.com/gofiber/fiber / sanitizeFilename

Function sanitizeFilename

res.go:182–196  ·  view source on GitHub ↗
(filename string)

Source from the content-addressed store, hash-verified

180}
181
182func sanitizeFilename(filename string) string {
183 for _, r := range filename {
184 if unicode.IsControl(r) {
185 b := make([]byte, 0, len(filename))
186 for _, rr := range filename {
187 if !unicode.IsControl(rr) {
188 b = utf8.AppendRune(b, rr)
189 }
190 }
191 return utils.TrimSpace(string(b))
192 }
193 }
194
195 return utils.TrimSpace(filename)
196}
197
198func fallbackFilenameIfInvalid(filename string) string {
199 if filename == "" || filename == "." {

Callers 2

AttachmentMethod · 0.85
DownloadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected