MushroomObserver / mushroom-observer

A website for sharing observations of mushrooms.
https://mushroomobserver.org
MIT License
77 stars 25 forks source link

Invalid license_id #2071

Closed JoeCohen closed 5 months ago

JoeCohen commented 5 months ago

I've lately noticed website Errors like this:

INFO -- : Started GET "/images/1601046?q=1oaSB" for 74.37.1.165 at 2024-03-28 13:00:51 +0000
INFO -- : Processing by ImagesController#show as HTML
INFO -- :   Parameters: {"q"=>"1oaSB", "id"=>"1601046"}
WARN -- : user=667 robot=N ip=74.37.1.165
INFO -- :   Rendered layout controllers/layouts/application.html.erb (Duration: 2115.1ms | Allocations: 14037)
INFO -- : Completed 500 Internal Server Error in 2249ms (ActiveRecord: 2081.0ms | Allocations: 17911)
E, [2024-03-28T13:00:53.418366 #120533] ERROR -- :   
ActionView::Template::Error (undefined method `form_name' for nil):
    40:         <%= image_copyright(@image) %>
    41:       </div>
    42:       <div class="py-5px mb-3">
    43:         <%= render(partial: "shared/form_#{@image.license.form_name}") %>
    44:       </div>
    45:     </div>
    46:   </div><!--.col-->

The underlying problem is that the image has an invalid license_id. We have only 4 licenses, ids 1-4. This image has a license id of 2023. There are 195 images with an invalid license_id. The license_id's range from 2015-2023 -- they are years.

Questions

  1. What to do about the above images? I suggest manually setting the license_id to our most restrictive license. (Creative Commons Non-commercial.
  2. Should the template be revised so that it doesn't throw an error if there's a bad license_id? My take is no; we want to know about such images.
  3. Any idea about the cause? The UX pages I've looked at make you choose the license from a drop-down list. Am I missing some page?
  4. Is there any chance that this is happening through the API? [edited: almost certainly not. See next comment for messed up images on an Observation created via the website..]
JoeCohen commented 5 months ago

Three of these are my images. They are the images for https://mushroomobserver.org/530103. That Observation was created via the website. So this is not an API issue. I have no clue why the license_id is "2023".

JoeCohen commented 5 months ago

The screwed up images have create_at ranging from 05 Aug 2019 to 22 Sep 2023. All have the when year = 0000. license_id seems to be the year the photo was taken. Sample screwed up image:

#<Image:0x00000001236df140
 id: 1070308,
 created_at: Mon, 05 Aug 2019 10:08:21.000000000 EDT -04:00,
 updated_at: Mon, 05 Aug 2019 10:08:21.000000000 EDT -04:00,
 content_type: "image/jpeg",
 user_id: 26330,
 when: Tue, 05 Oct 0000,
 notes: "",
 copyright_holder: "Nat",
 license_id: 2015,
 num_views: 1,
 last_view: Wed, 20 May 2020 10:22:06.000000000 EDT -04:00,
 width: 2048,
 height: 1152,
 vote_cache: nil,
 ok_for_export: true,
 original_name: nil,
 transferred: true,
 gps_stripped: false,
 diagnostic: true>
JoeCohen commented 5 months ago

@mc-nathan, @pellaea Any thoughts on how to handle this? (I think we should

JoeCohen commented 5 months ago

I updated the database to correct the broken Images per the prior Comment. I therefore am Closing this Issue.