publiclab / plots2

a collaborative knowledge-exchange platform in Rails; we welcome first-time contributors! :balloon:
https://publiclab.org
GNU General Public License v3.0
960 stars 1.83k forks source link

Error viewing some tag pages #10270

Closed ebarry closed 3 years ago

ebarry commented 3 years ago

Please describe the problem

What happened just before the problem occurred? Or what problem could this idea solve?

I typed spectralworkbench into our Search Bar. i chose the first autosuggested result because i was looking for the tag page, and was surprised to see this error page:

tag-error

What did you expect to see that you didn't?

I expected to see a tag page with content tagged spectralworkbench

Please show us where to look

https://publiclab.org/tag/spectralworkbench

What's your PublicLab.org username?

This can help us diagnose the issue:

liz

ebarry commented 3 years ago

A staff member reports that:

I'm getting an error message when trying to load certain tag pages again (similar to an issue from August).

Affected pages:

tag_page_error
jywarren commented 3 years ago

I /think/ the error is this:

[e0fbe334-265a-4f2f-b73e-9cae3e3174ab] Completed 500 Internal Server Error in 439ms 
(ActiveRecord: 212.9ms)
[e0fbe334-265a-4f2f-b73e-9cae3e3174ab]   
[e0fbe334-265a-4f2f-b73e-9cae3e3174ab] ActionView::Template::Error (undefined method `photo_file_name' for #<DrupalFile:0x00007f60c1536f50>):
[e0fbe334-265a-4f2f-b73e-9cae3e3174ab]     1: <div class="card">
[e0fbe334-265a-4f2f-b73e-9cae3e3174ab]     2:   <% if node.main_image %>
[e0fbe334-265a-4f2f-b73e-9cae3e3174ab]     3:     <% img_path = node.main_image.path(node.main_image.photo_file_name == "blob" ? :original : :default) # special case for "blob" images, see https://github.com/publiclab/plots2/issues/10210 %>
[e0fbe334-265a-4f2f-b73e-9cae3e3174ab]     4:     <a class="card-img-top img" style="overflow: hidden; height:10em;"<% if @widget %>target="_blank"<% end %> href="<%= node.path %>"><%= image_tag(img_path, style:'width:100%;', lazy: node.main_image.photo_file_name =! "blob") %></a>
[e0fbe334-265a-4f2f-b73e-9cae3e3174ab]     5:   <% elsif node.scraped_image %>
[e0fbe334-265a-4f2f-b73e-9cae3e3174ab]     6:     <a class="card-img-top img" style="overflow: hidden; height:10em;" href="<%= node.path %>"><%= image_tag(node.scraped_image, style:'width:100%;') %></a>

So we need to use a different method than photo_file_name when screening for 'blob'. Should be a quick fix!

jywarren commented 3 years ago

Attempted quick fix in https://github.com/publiclab/plots2/commit/c6c022ebda0a49a2c7f503aa19e7f6559562d49c

monitoring at https://stable.publiclab.org/tag/stormwater before publishing

jywarren commented 3 years ago

or https://stable.publiclab.org/tag/thermal-photography

jywarren commented 3 years ago

additional fix in https://github.com/publiclab/plots2/commit/7c49c774f38ba16431e808202783821cc86fd678

jywarren commented 3 years ago

I believe it's fixed and will publish these changes in about 1 hour.

jywarren commented 3 years ago

Confirmed this is fixed!

ebarry commented 3 years ago

Thank you!