You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will cause the server to return a 404 error, which leads to very sinister bugs when used with something like Ok(counter), where counter needs to be a Long to ensure it's large enough. Don't ask how I found this bug 😉.
The loop over the response (line 409) hence unwraps the Ok(404l) and returns a 404l, which then matches 404 even though it shouldn't (in a certain sense, this is a problem in Scala... Why the hell would it implicitly downcast here?).
Maybe it would be best to rethink the loop logic? I'm sure it's there for some reason, so it's probably impossible to throw out the program flow itself, but there are other weird corner cases like this, unfortunately. I'd personally disallow plain status codes entirely, but I understand this is probably a Sinatra convention.
The text was updated successfully, but these errors were encountered:
Will cause the server to return a 404 error, which leads to very sinister bugs when used with something like
Ok(counter)
, wherecounter
needs to be a Long to ensure it's large enough. Don't ask how I found this bug 😉.The problem lies in ScalatraBase.scala, because this case will not match when given a Long: https://github.com/scalatra/scalatra/blob/d2e247172af40ad21edd16a6a5aebc29549bcb14/core/src/main/scala/org/scalatra/ScalatraBase.scala#L435C1-L435C1
The loop over the response (line 409) hence unwraps the
Ok(404l)
and returns a404l
, which then matches404
even though it shouldn't (in a certain sense, this is a problem in Scala... Why the hell would it implicitly downcast here?).Maybe it would be best to rethink the loop logic? I'm sure it's there for some reason, so it's probably impossible to throw out the program flow itself, but there are other weird corner cases like this, unfortunately. I'd personally disallow plain status codes entirely, but I understand this is probably a Sinatra convention.
The text was updated successfully, but these errors were encountered: