Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3483 closed defect (fixed)

"Load list of changesets from the server" is broken for users with non-ASCII usernames

Reported by: avarab@… Owned by: team
Priority: major Milestone:
Component: Core Version: latest
Keywords: Cc:

Description

The recent refresh button in the upload dialog that calls /api/0.6/user/details is broken for users with multibyte usernames.

All operations in JOSM (download/upload/etc) that I tried to network sniff had the same "Authorization: Basic" string. Except the new changeset refresher. It appears to be sending the username in ISO-8895-1 instead of UTF-8.

Here's what JOSM says to the server and what it gets back. Minus my auth details.

192.168.178.049.59489-128.040.168.103.00080: GET /api/0.6/user/details HTTP/1.1

Accept-Encoding: gzip, deflate

User-Agent: JOSM/1.5 (2116 SVN en) Java/1.6.0_16

Host: api06.dev.openstreetmap.org

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

Connection: keep-alive

Authorization: Basic BROKEN SEEKRT



128.040.168.103.00080-192.168.178.049.59489: HTTP/1.1 500 Internal Server Error

Date: Sun, 13 Sep 2009 19:17:37 GMT

Server: Apache/2.2.8 (Ubuntu) Phusion_Passenger/2.2.5 PHP/5.2.4-2ubuntu5.7 with Suhosin-Patch

X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.2.5

Cache-Control: no-cache

Content-Length: 15765

Status: 500

Connection: close

Content-Type: text/html; charset=utf-8



<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Action Controller: Exception caught</title>
  <style>
    body { background-color: #fff; color: #333; }

    body, p, ol, ul, td {
      font-family: verdana, arial, helvetica, sans-serif;
      font-size:   13px;
      line-height: 18px;
    }

    pre {
      background-color: #eee;
      padding: 10px;
      font-size: 11px;
    }

    a { color: #000; }
    a:visited { color: #666; }
    a:hover { color: #fff; background-color:#000; }
  </style>
</head>
<body>

<h1>
  ActiveRecord::StatementInvalid
  
    in UserController#api_details
  
</h1>
<pre>PGError: ERROR:  invalid byte sequence for encoding &quot;UTF8&quot;: 0xc676
HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by &quot;client_encoding&quot;.
: SELECT * FROM &quot;users&quot; WHERE (email = E'.var Arnfj.r. Bjarmason' OR display_name = E'.var Arnfj.r. Bjarmason')  LIMIT 1</pre>



<p><code>RAILS_ROOT: /h
128.040.168.103.00080-192.168.178.049.59489: ome/edgemaster/apis/api06</code></p>

<div id="traces">
  
    
    <a href="#" onclick="document.getElementById('Framework-Trace').style.display='none';document.getElementById('Full-Trace').style.display='none';document.getElementById('Application-Trace').style.display='block';; return false;">Application Trace</a> |
  
    
    <a href="#" onclick="document.getElementById('Application-Trace').style.display='none';document.getElementById('Full-Trace').style.display='none';document.getElementById('Framework-Trace').style.display='block';; return false;">Framework Trace</a> |
  
    
    <a href="#" onclick="document.getElementById('Application-Trace').style.display='none';document.getElementById('Framework-Trace').style.display='none';document.getElementById('Full-Trace').style.display='block';; return false;">Full Trace</a> 
  

  
    <div id="Application-Trace" style="display: block;">
      <pre><code>/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `old_log'
/home/edgemaster/apis/api06/config/initializers/abstract_adapter.rb:9:in `log'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:550:in `execute'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:1037:in `select_raw'
/var/lib/ge
128.040.168.103.00080-192.168.178.049.59489: ms/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:1024:in `select'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/home/edgemaster/apis/api06/config/initializers/query_cache.rb:6:in `cache_sql'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:661:in `find_by_sql'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:1548:in `find_every'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:1505:in `find_initial'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:613:in `find'
/home/edgemaster/apis/api06/app/models/user.rb:48:in `authenticate'
/home/edgemaster/apis/api06/app/controllers/application_controller.rb:78:in `setup_user_auth'
/home/edgemaster/apis/api06/app/controllers/application_controller.rb:85:in `authorize'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `send'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `evaluate_me
128.040.168.103.00080-192.168.178.049.59489: thod'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:166:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:225:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:629:in `run_before_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:615:in `call_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:10:in `realtime'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/flash.rb:146:in `perform_action'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in `send'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/b
128.040.168.103.00080-192.168.178.049.59489: ase.rb:532:in `process_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:606:in `process'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:391:in `process'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:386:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:437:in `call'</code></pre>
    </div>
  
    <div id="Framework-Trace" style="display: none;">
      <pre><code>/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:87:in `dispatch'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:121:in `_call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:114:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:108:in `call'
/usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:95:in `process_request'
/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:378:in `start_request_handler'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:336:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/ut
128.040.168.103.00080-192.168.178.049.59489: ils.rb:183:in `safe_fork'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:334:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_pas
128.040.168.103.00080-192.168.178.049.59489: senger/abstract_server.rb:196:in `start_synchronously'</code></pre>
    </div>
  
    <div id="Full-Trace" style="display: none;">
      <pre><code>/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `old_log'
/home/edgemaster/apis/api06/config/initializers/abstract_adapter.rb:9:in `log'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:550:in `execute'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:1037:in `select_raw'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:1024:in `select'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/home/edgemaster/apis/api06/config/initializers/query_cache.rb:6:in `cache_sql'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:661:in `find_by_sql'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:1548:in `find_every'
/var/lib/
128.040.168.103.00080-192.168.178.049.59489: gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:1505:in `find_initial'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:613:in `find'
/home/edgemaster/apis/api06/app/models/user.rb:48:in `authenticate'
/home/edgemaster/apis/api06/app/controllers/application_controller.rb:78:in `setup_user_auth'
/home/edgemaster/apis/api06/app/controllers/application_controller.rb:85:in `authorize'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `send'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `evaluate_method'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:166:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:225:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:629:in `run_before_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:615:in `call_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_
128.040.168.103.00080-192.168.178.049.59489: ext/benchmark.rb:10:in `realtime'
/var/lib/gems/1.8/gems/activesupport-2.3.4/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/flash.rb:146:in `perform_action'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in `send'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:532:in `process_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/filters.rb:606:in `process'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:391:in `process'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb:386:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:437:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:87:in `dispatch'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:121:in `_call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in 
128.040.168.103.00080-192.168.178.049.59489: `call'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:29:in `call'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:9:in `cache'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/query_cache.rb:28:in `call'
/var/lib/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/var/lib/gems/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in `call'
/var/lib/gems/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:24:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/params_parser.rb:15:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/session/abstract_store.rb:122:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/failsafe.rb:26:in `call'
/var/lib/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
/var/lib/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `synchronize'
/var/lib/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:114:in `call'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/reloader.rb:34:in `run'
/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/di
128.040.168.103.00080-192.168.178.049.59489: spatcher.rb:108:in `call'
/usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:95:in `process_request'
/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:378:in `start_request_handler'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:336:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/utils.rb:183:in `safe_fork'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:334:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
/usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/us
128.040.168.103.00080-192.168.178.049.59489: r/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
/usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/lib/phusion_passenger/passenger-spawn-server:61</code></pre>
    </div>
  
</div>






<h2 style="margin-top: 30px">Request</h2>
<p><b>Parameters</b>: <pre>None</pre></p>

<p><a href="#" onclick="document.getElementById('session_dump').style.display='block'; return false;">Show session dump</a></p>
<div id="session_dump" style="display:none"><pre class='debug_dump'>--- 
</pre></div>


<h2 style="margin-top: 30px">Response</h2>
<p><b>Headers</b>: <pre>{&quot;Content-Type&quot;=&gt;&quot;&quot;,
 &quot;Cache-Control&quot;=&gt;&quot;no-cache&quot;}</pre></p>



</body>
</html>

Attachments (0)

Change History (4)

comment:1 Changed 8 years ago by avarab@…

Furthermore when I change my username in preferences to my (ascii) e-mail the other parts of JOSM (download/upload) take note of this and send a new Auth string. But the changeset list keeps sending the iso-8859-1 encoded username.

comment:2 Changed 8 years ago by Gubaer

(In [2124]) See #3483: "Load list of changesets from the server" is broken for users with non-ASCII usernames

comment:3 Changed 8 years ago by Gubaer

Resolution: fixed
Status: newclosed

I've patched it in such a way that /api/0.6/user/details uses the same encoding routines as the API methods for writing.

I didn't test with one of these multibyte account, though. Avar, could you please run another test with yours?

comment:4 in reply to:  3 Changed 8 years ago by avarab@…

Replying to Gubaer:

I didn't test with one of these multibyte account, though. Avar, could you please run another test with yours?

Done. It works now. Thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.