psu-libraries / scholarsphere-3

A web application for ingest, curation, search, and display of digital assets. Powered by Hydra technologies (Rails, Hydra-head, Blacklight, Solr, Fedora Commons, etc.)
Apache License 2.0
78 stars 24 forks source link

Uploading Multiple Files from Dropbox Gives Not Found Error #958

Closed mtribone closed 7 years ago

mtribone commented 7 years ago

When I create a new work or edit an existing work and add multiple files from Dropbox, I get a "not found" error after i hit save.

screen shot 2017-06-19 at 10 42 40 am

carolyncole commented 7 years ago

Rendering 404 page due to exception: #<ActiveRecord::RecordNotFound: Couldn't find all Sufia::UploadedFiles with 'id': (https://dl.dropboxusercontent.com/1/view/td8aethmb3kh15m/C.F.Martin_Tour-24.jpg, https://dl.dropboxusercontent.com/1/view/awuczta57bzz166/CAP102_tut_anim.pdf, https://dl.dropboxusercontent.com/1/view/wz5xnupupc7zzis/end_is_nigh.jpg, https://dl.dropboxusercontent.com/1/view/2frim4t2ijuycus/Isometric%20Grids/isometricLL12b.ai, https://dl.dropboxusercontent.com/1/view/93ahwsqqxzc98fx/Isometric%20Grids/isometricLL15b.ai, https://dl.dropboxusercontent.com/1/view/a7pig2bt9vypvqm/Isometric%20Grids/isometricLL18b.ai, https://dl.dropboxusercontent.com/1/view/klpnec1no9ixeaj/Isometric%20Grids/isometricLP12b.ai, https://dl.dropboxusercontent.com/1/view/r71b3f84pos02gt/Isometric%20Grids/isometricLP15b.ai, https://dl.dropboxusercontent.com/1/view/tngvozf6aqbckl2/Isometric%20Grids/isometricLP18b.ai, https://dl.dropboxusercontent.com/1/view/25lhzkaah6dsr85/that_we_may_eat.jpg) (found 0 results, but was looking for 10)> - ["/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/relation/finder_methods.rb:324:in raise_record_not_found_exception!'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/relation/finder_methods.rb:467:infind_some'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/relation/finder_methods.rb:426:in find_with_ids'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/relation/finder_methods.rb:71:infind'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/querying.rb:3:in find'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/core.rb:131:infind'", "/opt/heracles/deploy/scholarsphere/shared/bundle/ruby/2.3.0/bundler/gems/sufia-603e8fc8bd4f/app/actors/sufia/create_with_files_actor.rb:43:in `uploaded_files'"

carolyncole commented 7 years ago

This seems to happen when files are added via cloud while editing a work. not sure if it is only dropbox or if this error also happens with box.

mtribone commented 7 years ago

Also happens with Box when editing a work and adding files.

carolyncole commented 7 years ago

From what I can tell the actor is expecting the attributes to include remote_files, but instead they include uploaded_files.

>> attributes
=> {"title"=>["to edit or not to edit"], "creator"=>["Santy, Lorraine C"], "contributor"=>[], "description"=>["to edit or not to edit we want to be able to edit"], "keyword"=>["edit"], "rights"=>"https://creativecommons.org/licenses/by-nc/4.0/", "publisher"=>[], "date_created"=>[], "subject"=>[], "language"=>[], "identifier"=>[], "based_near"=>[], "related_url"=>[], "representative_id"=>"xpn89d784j", "thumbnail_id"=>"xpn89d784j", "visibility_during_embargo"=>"restricted", "embargo_release_date"=>"2017-06-23", "visibility_after_embargo"=>"open", "visibility_during_lease"=>"open", "lease_expiration_date"=>"2017-06-23", "visibility_after_lease"=>"restricted", "source"=>[], "collection_ids"=>[], "resource_type"=>["Article"], "remote_files"=>[], "uploaded_files"=>["https://dl.boxcloud.com/d/1/Vi7utS3A5MGrVcIhCkgAAn0IlkXDq8AmolTzrO85DaOJCI78__Bysiqtlkkz6DKGwPn__J-EKDAo7iZxUM8bZVvlDFY0jCTAQONDJKnAqpWmqNBZH_lbp8uLyqdQKSyOksn10de3IHhfDVJeEZf_aUuOqPpqa0wgj0uvwDSeypWCCnDgSOY616SRFnVxivagRI5UvWA1O5msQJpwkDEkeZgoA-Q1TkiQ79NzI4p47hOposWVqs13Oj7VjdbX6XJA9r18GdJ3ylVhCXHvIelKjVySbFIwZwYe4t0TjInvdTHPHIWCVNUov54F1HP2RijxT3AOw8csRR45K-FIhj_75nE2D3hhrrz2sEr6C5DTIVlpCmvguklq7fmdlTVJ5krm-QEgiVMvVG2HX57nBnVPoP68Qi7L4PwJwp6-ubPXmcX4LwPDZWuaL7GorZSZE4-kzqpfmQkzo-iIJYeGwe7qOTaXEc_9Vco6_hGIkqYZchXDedQDwS6yAGv6LrGjLdzv6aCS0VKMUBcya2Sny2xJaUGqwWr7y-MvaiUCEU7jDz7s9buotW7-6FTMnQzkmVlcaHhRAlaHpKUfHSyOrYWUgDdjJDiYt8owRw5VjzL6gplbwKcS2gf31WxAmiJ2a9TGzCwajQVq98X58J4PXzN8Zv0CdM0m2OwzclJClqBeZAfovunNDWHPRS6nQItzNx9GV_4Nwo1H-LAgZl-tz88phpc5JzHM9kUCo5krvDeUT2tmA76Pd8n0Y7nrRPxxahYO_MbGtess-O62QyZLicjE_YAd88-m4JoZInZHghe-Bi9giUFcHWPfFRhmT51DssNungCqLkpbOkZdEw4vGutV4j2NiREB6-eGaF0xe8KFAvjeH-P3_4MgRv2LppXd5R5j2JhhZ548rCrRE3BptMucprija0BSD2bb0h1zWIUJyYIa-ucwFRfmC_Z4ddgmS8HQ0x48sm1BADmJF90n9Sh2HFzT48o3hXjuGcOHoYjOa_Mr_DmjqM6dEN7UuZjBuDOzZjK_J8ITxS75rH26wGyPVHcuDvGcUMw2NyKXeXygWmhTXwoJK61APG9B4AAQ/download"]}
awead commented 7 years ago

remote_files is built in attributes_for_actor where is looks for the selected_files parameter.

BE is returning the same response each time, something like:

Started POST "/browse/resolve" for ::1 at 2017-06-26 16:50:18 -0400
2017-06-26 16:50:18 -0400 (49759) Processing by BrowseEverythingController#resolve as JSON
2017-06-26 16:50:18 -0400 (49759)   Parameters: {"utf8"=>"✓", "authenticity_token"=>"6C1Lzlko1S0+ZQwPUmRhxfR4od+z1jHqA59lgKzpD9vFVFT4zJM+QgCLS1tRWc8NhSd6XLTAs9fQDh5P5zn/xA==", "context"=>"", "selected_files"=>["file_system:/Users/awead/Desktop/lebowski.png"]}

In the #new page, this results in an inserted file element that looks like:

<input type="hidden" name="selected_files[0][url]" value="file:///Users/awead/Desktop/junk.jpg">
<input type="hidden" name="selected_files[0][file_name]" value="junk.jpg">
<input type="hidden" name="selected_files[0][file_size]" value="1024000"></form>

But in the #edit page it looks like:

<input type="hidden" class="ev-url" name="selected_files[]" value="file_system:/Users/awead/Desktop/cat.zip">

So there there maybe something wrong with the jbuilder template that's used to insert new files into the form.