The difference here is that the action is not called via a XHR (because it uploads a file), but a regular request. That's why rails assumes it should render a HTML template (which it did before this change). But the response is still evaluated as javascript.
We could instead tweak the request, so that rails detects it to require a javascript response, but I couldn't figure out how.