What you see is a compiler warning, but the app will run.
Your condition is always true
:
contentType != "image/jpeg" || contentType != "image/png"
You compare a string
variable to 2 different string
values (using not equal), so one of them will surely be true
, and true || false
is always true
.
Most likely you need logical AND: I assume you want to test if the content type is neither JPEG nor PNG:
if contentType != "image/jpeg" && contentType != "image/png" {
return
}