فهرست منبع

Forced hostname to end with /

Winston Li 12 سال پیش
والد
کامیت
cfe23b57ff

+ 5 - 1
services/git-bridge/src/uk/ac/ic/wlgitbridge/application/Config.java

@@ -39,7 +39,11 @@ public class Config implements JSONSource {
         apiKey = getElement(configObject, "apiKey").getAsString();
         username = getOptionalString(configObject, "username");
         password = getOptionalString(configObject, "password");
-        hostname = getElement(configObject, "hostname").getAsString();
+        String hostname = getElement(configObject, "hostname").getAsString();
+        if (!hostname.endsWith("/")) {
+            hostname += "/";
+        }
+        this.hostname = hostname;
         serviceName = getElement(configObject, "serviceName").getAsString();
     }
 

+ 2 - 4
services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/api/request/base/SnapshotAPIRequest.java

@@ -10,10 +10,11 @@ public abstract class SnapshotAPIRequest<T extends Result> extends Request<T> {
     private static String USERNAME;
     private static String PASSWORD;
 
+    /* Must end with / */
     private static String BASE_URL;
 
     public SnapshotAPIRequest(String projectName, String apiCall) {
-        super(BASE_URL + "/" + projectName + apiCall);
+        super(BASE_URL + projectName + apiCall);
     }
 
     protected Realm buildRequestRealm() {
@@ -31,9 +32,6 @@ public abstract class SnapshotAPIRequest<T extends Result> extends Request<T> {
     }
 
     public static void setBaseURL(String baseURL) {
-        if (!(baseURL.endsWith("/"))) {
-            baseURL += "/";
-        }
         BASE_URL = baseURL;
     }