Browse Source

fix cannot parse JSON for attachments

Unknwon 9 years ago
parent
commit
17f3e840ec
2 changed files with 5 additions and 3 deletions
  1. 3 3
      public/js/gogs.js
  2. 2 0
      routers/repo/issue.go

+ 3 - 3
public/js/gogs.js

@@ -223,7 +223,7 @@ $(document).ready(function () {
     $('.dropdown').dropdown();
     $('.jump.dropdown').dropdown({
         action: 'hide',
-        onShow: function() {
+        onShow: function () {
             $('.poping.up').popup('hide');
         }
     });
@@ -237,8 +237,8 @@ $(document).ready(function () {
     });
     $('.poping.up').popup();
     $('.top.menu .poping.up').popup({
-        onShow: function() {
-            if ( $('.top.menu .menu.transition').hasClass('visible') ) {
+        onShow: function () {
+            if ($('.top.menu .menu.transition').hasClass('visible')) {
                 return false;
             }
         }

+ 2 - 0
routers/repo/issue.go

@@ -11,6 +11,7 @@ import (
 	"io/ioutil"
 	"net/http"
 	"net/url"
+	"os"
 	"strings"
 	"time"
 
@@ -724,6 +725,7 @@ func uploadFiles(ctx *middleware.Context, issueId, commentId int64) {
 			return
 		}
 
+		os.MkdirAll(setting.AttachmentPath, os.ModePerm)
 		out, err := ioutil.TempFile(setting.AttachmentPath, "attachment_")
 
 		if err != nil {