<p></p>
<h3 dir="auto">URL</h3>
<p dir="auto"><a href="https://www.openstreetmap.org/api/0.6/user/preferences" rel="nofollow">https://www.openstreetmap.org/api/0.6/user/preferences</a></p>
<h3 dir="auto">How to reproduce the issue?</h3>
<ul dir="auto">
<li>find an old user who has lone percent sign (<code class="notranslate">%</code>) somewhere in preferences. For <a href="https://www.openstreetmap.org/user/Matija%20Nalis" rel="nofollow">me</a>, it was some preferences put by <a href="https://wiki.openstreetmap.org/wiki/Merkaartor" rel="nofollow">Merkaartor</a> app some number of years ago, in the following format:</li>
</ul>
<pre class="notranslate"><code class="notranslate"><preference k="MerkaartorTmsServer003" v="OSM Mapnik;tile.openstreetmap.org;/%1/%2/%3.png;256;0;17"/>
</code></pre>
<p dir="auto">(you need to use an old user, as it is impossible to recreate preferences with lone <code class="notranslate">%</code> even for testing)</p>
<ul dir="auto">
<li>you do <code class="notranslate">GET /api/0.6/user/preferences</code> and read those preferences just fine</li>
<li>however, when you try to <code class="notranslate">PUT /api/0.6/user/preferences</code> them back again (with some or no changes), you get <code class="notranslate">400 Bad Request</code> HTTP error (without any more informative <code class="notranslate">error</code> header/text (like one might get for trying to e.g. upload duplicate key or other errors).</li>
</ul>
<p dir="auto">That is quite unfortunate, at it means (among other things) that people who have used Merkaartor (or other apps which might use <code class="notranslate">%</code> in preferences) in the past are (among other things, but as an example) <a href="https://github.com/tyrasd/overpass-turbo/issues/666#issuecomment-1883698962" data-hovercard-type="issue" data-hovercard-url="/tyrasd/overpass-turbo/issues/666/hovercard">unable to save overpass-turbo queries to OSM</a> any more (note that overpass-turbo had another unrelated but there, but fixing it only fixed the issue for some people, not all).</p>
<h3 dir="auto">Screenshot(s) or anything else?</h3>
<p dir="auto">Possible solutions (from more preferred to less preferred)</p>
<ul dir="auto">
<li>Allow lone <code class="notranslate">%</code> in the preferences again, as they were allowed in the past (i.e. undo the regression that introduced this change). That would fix this, and likely related issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1659233455" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/4001" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/4001/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/4001">#4001</a>. The advantage is that nothing else needs to be changed and everything starts working automagically.</li>
<li>replace lone <code class="notranslate">%</code> (i.e. not followed by 2 hexadecimal characters) in the OSM preferences database by <a href="https://en.wikipedia.org/wiki/Percent-encoding" rel="nofollow">percent-encoded</a> <code class="notranslate">%25</code>, as it seems to be what OSM API expects nowdays (at least the error is gone and preference is uploaded when one does that). The disadvantage is that any app which uses such values need to be informed that they need to parse percent-encoded values now.<br>
E.g. example above would become:</li>
</ul>
<pre class="notranslate"><code class="notranslate"><preference k="MerkaartorTmsServer003" v="OSM Mapnik;tile.openstreetmap.org;/%251/%252/%253.png;256;0;17"/>
</code></pre>
<ul dir="auto">
<li>delete (after backing up) all keys in preferences database that contain lone <code class="notranslate">%</code>. That would at least allow preferences to be changed / saved again and avoid user frustration (but original data would be lost -- hopefully it is only old historical preferences of little value).</li>
<li>at least <a href="https://wiki.openstreetmap.org/wiki/API_v0.6#Preferences_of_the_logged-in_user:_GET_/api/0.6/user/preferences" rel="nofollow">document</a> this <code class="notranslate">%</code> behaviour (and possible remedy for affected users)</li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/4467">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLJAXWEFK27G2VFQO3LYNW6FPAVCNFSM6AAAAABBTZVT7SVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3TGMRVHAZTMNA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLIRI67TUSKLMI2RK6DYNW6FPA5CNFSM6AAAAABBTZVT7SWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHHXE3JPQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/issues/4467</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/4467",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/4467",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>