···286286 mimeType = "image/svg+xml"287287 }288288289289- if !strings.HasPrefix(mimeType, "image/") && !strings.HasPrefix(mimeType, "video/") {290290- l.Error("attempted to serve non-image/video file", "mimetype", mimeType)291291- writeError(w, "only image and video files can be accessed directly", http.StatusForbidden)289289+ // allow image, video, and text/plain files to be served directly290290+ switch {291291+ case strings.HasPrefix(mimeType, "image/"):292292+ // allowed293293+ case strings.HasPrefix(mimeType, "video/"):294294+ // allowed295295+ case strings.HasPrefix(mimeType, "text/plain"):296296+ // allowed297297+ default:298298+ l.Error("attempted to serve disallowed file type", "mimetype", mimeType)299299+ writeError(w, "only image, video, and text files can be accessed directly", http.StatusForbidden)292300 return293301 }294302