Fix URI double escaping

There were two problems here that had to be solved at the same time:
1) Escaping for a URI path uses different rules than encoding for a URL
   form. URLEncoder is intended for forms, so switch to using Guava's
   UrlEscapers.urlPathSegmentEscaper().
2) When we replace the ${name} token in the JGit URIish, we need to call
   uri.setRawPath() so that uri.path is set to the unescaped URI.

Add tests showing the now fixed URI escaping in the context of
ReplicationTaskStorage. Also refactor getURI() to make it more testable
and add tests for the correct behavior.

Change-Id: I9be55fafd78f546aecdeffebedd1d0d5e136022f
Release-Notes: https remote URIs correctly escape project names
Release-Notes: Stored tasks with (broken) double escaped URIs must be manually removed
3 files changed
tree: 4de9dc4cda3081cc8369bf48cd5a3d7fb1bf0162
  1. .settings/
  2. src/
  3. .gitignore
  4. .mailmap
  5. BUILD
  6. LICENSE