I figured out my problem here, but I don't think it explains the entire issue. The problem was that some files where not uploading as image files and instead the @uploaded_file was a String. If I check the class of the file first I can work around the problem. I still don't think it makes sense that there are no exceptions thrown.
Here's a simplified look at the code in my rails model. if @uploaded_file.class == File || @uploaded_file.class == Tempfile begin img = Magick::Image::read(@uploaded_file.path).first self.data = @uploaded_file.read self.attributes = {:data_format => img.format, :height => img.rows, :width => img.columns, :filesize => img.filesize} return true rescue # there was an error end end On 5/16/07, John Lauck <[EMAIL PROTECTED]> wrote:
i have a rails app with a form that allows uploading an image file. I take the image file and read it into rmagick to verify that it's an image. For some reason I can't catch an exception thrown by rmagick inside the app. After an invalid image file is uploaded the process just hangs. I have to kill mongrel and restart to use the app again. img = Magick::Image::read(@uploaded_file.path).first This line above should throw a Magick::ImageMagickError exception. I've confirmed this with a simple ruby script. I've tried adding breakpoints and as soon as this line is reached there's no coming back, even the breakpointer hangs. I pasted the method from my active record class here: http://pastie.caboo.se/62122 . Does anyone have any ideas?
_______________________________________________ Mongrel-users mailing list Mongrel-users@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-users