sozialhelden / wheelmap-classic

:wheelchair: Legacy "classic" wheelmap.org (deprecated)
http://www.wheelmap.org
GNU Affero General Public License v3.0
47 stars 16 forks source link

Generated zip files (icons & marker) exist in 2 different paths #430

Open 1000miles opened 7 years ago

1000miles commented 7 years ago

At the moment when we generate a zip file (icons & marker) via bundle exec rake assets:create_zip it seems we have 2 different paths where these files are put which is confusing.

app folder:

public folder:

This is the code snippet we found for the rake task:

namespace :assets do
  desc 'Create a zip file containing icons and markers'
  task :create_zip do
    %w{marker icons}.each do |zip_name|
      cmd=<<-EOF
        cd #{Rails.root.join('app', 'assets', 'images')}
        zip -9 -q -r #{Rails.root.join('public', zip_name)} #{zip_name}
      EOF
      system cmd
    end
  end

@TODO:

Hoverbear commented 7 years ago

This is related to #424 potentially!

Hoverbear commented 7 years ago

Based on last modified times it seems like the public/*.zip files are unlikely to be used currently.

holgerd commented 7 years ago

@lennerd what do you think?

lennerd commented 7 years ago

As said the URI in the asset API endpoint is the URI used by the apps. Therefore it should be safe to remove the other option.

holgerd commented 7 years ago

@Hoverbear discuss with @1000miles on where to purge this (new or old env?)

Hoverbear commented 7 years ago

So according to the source code of the Android app code here it fetches the zip files listed by the API call from https://wheelmap.org/api/assets?api_key=$YOURKEY

This result looks like this:

{
   "conditions":{
      "page":1,
      "per_page":15,
      "format":"json",
      "locale":null
   },
   "meta":{
      "page":1,
      "num_pages":1,
      "item_count_total":2,
      "item_count":2
   },
   "assets":[
      {
         "id":1,
         "name":"marker",
         "modified_at":1484564705,
         "license":"cc-by-sa",
         "url":"https://asset3.wheelmap.org/marker.zip"
      },
      {
         "id":2,
         "name":"icons",
         "modified_at":1484564705,
         "license":"cc-by-sa",
         "url":"https://asset0.wheelmap.org/icons.zip"
      }
   ]
}

According to the iPhone app source code here I think it does the same.

Hoverbear commented 7 years ago

So i did some research based on that data. Here are the md5 hashes of the various files.

$ curl https://asset0.wheelmap.org/icons.zip -O && md5 icons.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  216k  100  216k    0     0   224k      0 --:--:-- --:--:-- --:--:--  223k
MD5 (icons.zip) = 865a5c2765ecde30d7125b4449081fa8
$ md5 ~/git/sozialhelden/wheelmap/public/icons.zip
MD5 (/Users/hoverbear/git/sozialhelden/wheelmap/public/icons.zip) = 865a5c2765ecde30d7125b4449081fa8
$ md5 ~/git/sozialhelden/wheelmap/app/assets/images/icons.zip
MD5 (/Users/hoverbear/git/sozialhelden/wheelmap/app/assets/images/icons.zip) = d51413e1c754cc40e88f8a6afc268d05

I note that https://asset0.wheelmap.org/images/icons.zip returns a 500 error.

So according to this the files downloaded by the applications is the same as the file in wheelmap/public/icons.zip.