1. Sebastian Sdorra
  2. scm-script-plugin

Commits

Sebastian Sdorra  committed d1e4001

fix script execution on firefox

  • Participants
  • Parent commits 2c547ac
  • Branches default

Comments (0)

Files changed (1)

File src/main/java/sonia/scm/script/resources/ScriptResource.java

View file
  • Ignore whitespace
 
 //~--- non-JDK imports --------------------------------------------------------
 
+import com.google.common.base.Strings;
 import com.google.common.base.Throwables;
 import com.google.inject.Inject;
 
 
     try
     {
-      String result = ScriptUtil.execute(manager, request.getContentType(),
+      String result = ScriptUtil.execute(manager, getContentType(request),
                         content);
 
       if (logger.isTraceEnabled())
    *
    * @param name
    *
+   * @param id
+   *
    * @return
    */
   @GET
     return new ScriptTypes(manager.getSupportedTypes());
   }
 
+  /**
+   * Method description
+   *
+   *
+   * @param request
+   *
+   * @return
+   */
+  private String getContentType(HttpServletRequest request)
+  {
+    String contentType = request.getContentType();
+
+    if (!Strings.isNullOrEmpty(contentType))
+    {
+      int index = contentType.indexOf(";");
+
+      if (index > 0)
+      {
+        contentType = contentType.substring(0, index);
+      }
+    }
+
+    return contentType;
+  }
+
   //~--- fields ---------------------------------------------------------------
 
   /** Field description */