Merge https://github.com/jk1/intellij-community
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Thu, 24 Dec 2015 10:54:37 +0000 (13:54 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Thu, 24 Dec 2015 10:54:37 +0000 (13:54 +0300)
1  2 
plugins/tasks/tasks-core/src/com/intellij/tasks/youtrack/YouTrackRepository.java

index 992c96809dc0b07d85df763ee80b5579cbed89c0,7e8667c64bd04d0db037dce41ac139c35615098d..404e76ca7bba885e3535f58d05b98e7226e64f39
@@@ -352,7 -352,8 +352,8 @@@ public class YouTrackRepository extend
    @Override
    public void updateTimeSpent(@NotNull LocalTask task, @NotNull String timeSpent, @NotNull String comment) throws Exception {
      checkVersion();
-     final HttpMethod method = doREST("/rest/issue/execute/" + task.getId() + "?command=work+Today+" + timeSpent.replaceAll(" ", "+") + "+" + comment, true);
+     String command = encodeUrl(String.format("work Today %s %s", timeSpent, comment));
+     final HttpMethod method = doREST("/rest/issue/execute/" + task.getId() + "?command=" + command, true);
      try {
        if (method.getStatusCode() != 200) {
          InputStream stream = method.getResponseBodyAsStream();
        Element element = new SAXBuilder(false).build(stream).getRootElement();
        final boolean timeTrackingAvailable = element.getName().equals("version") && VersionComparatorUtil.compare(element.getChildText("version"), "4.1") >= 0;
        if (!timeTrackingAvailable) {
 -        throw new Exception("This version of Youtrack the time tracking is not supported");
 +        throw new Exception("Time tracking is not supported in this version of Youtrack");
        }
      }
      finally {