catch panics on nsfw image detection.

This commit is contained in:
fiatjaf
2024-06-19 22:02:25 -03:00
parent 47423ddcc4
commit 037e55b230
2 changed files with 8 additions and 0 deletions

View File

@@ -118,6 +118,7 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
return
}
for _, url := range allUrls {
url = strings.Split(strings.Split(url, "?")[0], "#")[0]
if imageExtensionMatcher.MatchString(url) {
if isImageNSFW(url) {
log.Warn().Str("url", url).Str("event", data.nevent).Msg("detect nsfw image")