benwbrum / fromthepage

FromThePage is a wiki-like application for crowdsourcing transcription of handwritten documents.
http://fromthepage.com
GNU Affero General Public License v3.0
171 stars 51 forks source link

500 error replacing page image #3105

Closed saracarl closed 2 years ago

saracarl commented 2 years ago

The Grove is reporting:

We have had problems with the visual quality of documents on a very specific kind of light gray paper. Recently I have just made png images from the pdf and replaced the pages and it works beautifully. Today it’s not working. I receive this message when trying to replace the image:

Screenshot with a 500 error

The letter I was working on is 89. Is there something I’m doing wrong?

I was able to reproduce and found this in the logs:

I, [2022-04-15T15:33:03.416661 #5559]  INFO -- : Completed 500  in 14ms (ActiveRecord: 4.9ms | Allocations: 4823)
F, [2022-04-15T15:33:03.423020 #5559] FATAL -- :   
TypeError (can't quote ActionDispatch::Http::UploadedFile):

app/controllers/page_controller.rb:84:in `update'
saracarl commented 2 years ago

Here's where it's occurring: https://github.com/benwbrum/fromthepage/blob/main/app/controllers/page_controller.rb#L84

Solution seems to be adding the uploader to the page model: https://stackoverflow.com/questions/26215068/cant-cast-actiondispatchhttpuploadedfile-to-string-in-activeadmin