Hi! It is a nice practice to indicate the file type in the url of the download link to let users know what they are getting before actually pushing it down their throat.
Filename on the trace detail page often says "somecity.gpx" (as at the time of upload), download link is simply "data" and the resulting file is named "123456.gpx.gz" (gzipped later on server?), which makes it a bit confusing. Example: http://www.openstreetmap.org/user/Rigless/traces/308275 has a download link to http://www.openstreetmap.org/trace/308275/data my aim is to change that to http://www.openstreetmap.org/trace/308275/data.gpx and similarly at http://www.openstreetmap.org/user/StefanB/traces/137465 has the link: http://www.openstreetmap.org/trace/137465/data that should be: http://www.openstreetmap.org/trace/137465/data.gpx.gz I'm attaching an *UNTESTED* patch for above changes in the rails port. Going a step further would be to match also the base filename, not just extensions: Eg instead: http://www.openstreetmap.org/trace/308275/data link would be http://www.openstreetmap.org/trace/308275/308275.gpx or even just http://www.openstreetmap.org/trace/308275.gpx I couldn't find traces with other extensions (.tar.gz, .zip, .gpx.bz2 ...) for additional test cases, but it should be easy by peeking into database or into folder full of traces. Or having some faith that if it works for two types it should work for all of them. Related bug: http://trac.openstreetmap.org/ticket/498 - there the extension ".gpx" was probably hardcoded into the link. Can someone please apply the patch into their test rails setup and test it before committing to svn and pushing it to the main site please? thank you! Stefan
Index: app/views/trace/view.rhtml
===================================================================
--- app/views/trace/view.rhtml (revision 13565)
+++ app/views/trace/view.rhtml (working copy)
@@ -9,7 +9,7 @@
<table border="0">
<tr>
<td>Filename:</td>
- <td><%= @trace.name %> (<%= link_to 'download', :controller => 'trace',
:action => 'data', :id => @trace.id %>)</td>
+ <td><%= @trace.name %> (<%= link_to 'download', :controller => 'trace',
:action => 'data', :id => @trace.id, :format => @trace.extension_name %>)</td>
</tr>
<tr>
<td>Uploaded at:</td>
Index: config/routes.rb
===================================================================
--- config/routes.rb (revision 13565)
+++ config/routes.rb (working copy)
@@ -108,7 +108,7 @@
map.connect '/traces/mine/tag/:tag/page/:page', :controller => 'trace',
:action => 'mine'
map.connect '/trace/create', :controller => 'trace', :action => 'create'
map.connect '/trace/:id/data', :controller => 'trace', :action => 'data'
- map.connect '/trace/:id/data.:format', :controller => 'trace', :action =>
'data'
+ map.connect '/trace/:id/data:format', :controller => 'trace', :action =>
'data'
map.connect '/trace/:id/edit', :controller => 'trace', :action => 'edit'
map.connect '/trace/:id/delete', :controller => 'trace', :action => 'delete'
map.connect '/trace/:id/make_public', :controller => 'trace', :action =>
'make_public'
signature.asc
Description: OpenPGP digital signature
_______________________________________________ dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/dev

