wikimaps-dev / mapwarper

Wikimedia Commons map georectifier and warper. See wikimaps_new branch.
http://warper.wmflabs.org
11 stars 1 forks source link

Error when viewing unloaded map by logged out user #89

Closed timwaters closed 8 years ago

timwaters commented 8 years ago

An import will import maps and set their status to "unloaded" - when a not logged in user views it, the preview template is shown and theres an error there. Logged in users will trigger the request progress and load up the map

jjjI, [2016-03-17T11:47:39.527382 #18444]  INFO -- : Started GET "/maps/1198" for 88.97.108.253 at 2016-03-17 11:47:39 +0000
I, [2016-03-17T11:47:39.541369 #18444]  INFO -- : Processing by MapsController#show as HTML
I, [2016-03-17T11:47:39.541569 #18444]  INFO -- :   Parameters: {"id"=>"1198"}
I, [2016-03-17T11:47:39.611246 #18444]  INFO -- :   Rendered maps/preview.html.erb within layouts/mapdetail (47.8ms)
I, [2016-03-17T11:47:39.614509 #18444]  INFO -- : Completed 500 Internal Server Error in 73ms (ActiveRecord: 0.6ms)
F, [2016-03-17T11:47:39.618241 #18444] FATAL -- : 
ActionView::Template::Error (undefined method `maps' for #<#<Class:0x0000000556a428>:0x0000000474c490>):
     5:     A low resolution preview of the map is shown below.  <br />
     6:   </p>
     7:   <% 
     8:   extname = File.extname self.maps.first.image_url
     9:   if [".tiff", ".tif"].include? extname.downcase
    10:     preview_url =  @map.image_url.gsub('commons/', 'commons/thumb/') + '/lossless-page1-600px-' + File.basename(@map.image_url).gsub('File:', '') + '.png'
    11:   else
  app/views/maps/preview.html.erb:8:in `_app_views_maps_preview_html_erb___2411317571657189549_70193465821540'
-

When logged out, I think, and unloaded. So the map is unloaded, but the user is not logged in so they wont see the loading process

timwaters commented 8 years ago

yes, confirmed only occured when maps have the status unloaded, and when the map is viewed by a not logged in user.

timwaters commented 8 years ago

Fixed in commit 55b2d4e0c42761f4263aef6d7e8ce8b5d0c25e42