diff --git a/router/apiHandler.go b/router/apiHandler.go index 9c67fc1b..1aacf9d3 100644 --- a/router/apiHandler.go +++ b/router/apiHandler.go @@ -133,10 +133,17 @@ func ApiUploadHandler(w http.ResponseWriter, r *http.Request) { upload.Category, _ = strconv.Atoi(r.FormValue("category")) upload.SubCategory, _ = strconv.Atoi(r.FormValue("sub_category")) upload.Description = r.FormValue("description") +<<<<<<< HEAD var err error var code int +======= + + var err error + var code int + +>>>>>>> 5a32c00f503906080d518ceea69897f251933ac1 filesize, err, code = upload.ValidateMultipartUpload(r) if err != nil { http.Error(w, err.Error(), code) @@ -156,8 +163,13 @@ func ApiUploadHandler(w http.ResponseWriter, r *http.Request) { UploaderID: user.ID, Uploader: &user, } +<<<<<<< HEAD db.ORM.Create(&torrent) /*if err != nil { +======= + /*db.ORM.Create(&torrent) + if err != nil { +>>>>>>> 5a32c00f503906080d518ceea69897f251933ac1 util.SendError(w, err, 500) return }*/ diff --git a/service/api/api.go b/service/api/api.go index 3f15dbbc..978f3fbe 100644 --- a/service/api/api.go +++ b/service/api/api.go @@ -12,7 +12,10 @@ import ( "github.com/ewhal/nyaa/model" "github.com/ewhal/nyaa/service" +<<<<<<< HEAD "github.com/ewhal/nyaa/service/upload" +======= +>>>>>>> 5a32c00f503906080d518ceea69897f251933ac1 "github.com/ewhal/nyaa/util/metainfo" "github.com/zeebo/bencode" ) @@ -148,10 +151,18 @@ func (r *TorrentRequest) ValidateMultipartUpload(req *http.Request) (int64, erro if torrent.IsPrivate() { return 0, errors.New("private torrents not allowed"), http.StatusBadRequest } +<<<<<<< HEAD trackers := torrent.GetAllAnnounceURLS() if !uploadService.CheckTrackers(trackers) { return 0, errors.New("tracker(s) not allowed"), http.StatusBadRequest } +======= + //import cycle + /*trackers := torrent.GetAllAnnounceURLS() + if !router.CheckTrackers(trackers) { + return 0, errors.New("tracker(s) not allowed"), http.StatusBadRequest + }*/ +>>>>>>> 5a32c00f503906080d518ceea69897f251933ac1 if r.Name == "" { r.Name = torrent.TorrentName() diff --git a/test.torrent b/test.torrent new file mode 100644 index 00000000..5b48d5ae Binary files /dev/null and b/test.torrent differ