Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

correct? status codes

Cette révision appartient à :
ayame-git 2017-05-11 06:41:09 +03:00
Parent 42c79c2794
révision 19444c763f
2 fichiers modifiés avec 3 ajouts et 3 suppressions

Voir le fichier

@ -97,7 +97,7 @@ func ApiViewHandler(w http.ResponseWriter, r *http.Request) {
func ApiUploadHandler(w http.ResponseWriter, r *http.Request) { func ApiUploadHandler(w http.ResponseWriter, r *http.Request) {
if config.UploadsDisabled { if config.UploadsDisabled {
http.Error(w, "Error uploads are disabled", http.StatusInternalServerError) http.Error(w, "Error uploads are disabled", http.StatusBadRequest)
return return
} }

Voir le fichier

@ -146,11 +146,11 @@ func (r *TorrentRequest) ValidateMultipartUpload(req *http.Request) (int64, erro
} }
// check a few things // check a few things
if torrent.IsPrivate() { if torrent.IsPrivate() {
return 0, errors.New("private torrents not allowed"), http.StatusBadRequest return 0, errors.New("private torrents not allowed"), http.StatusNotAcceptable
} }
trackers := torrent.GetAllAnnounceURLS() trackers := torrent.GetAllAnnounceURLS()
if !uploadService.CheckTrackers(trackers) { if !uploadService.CheckTrackers(trackers) {
return 0, errors.New("tracker(s) not allowed"), http.StatusBadRequest return 0, errors.New("tracker(s) not allowed"), http.StatusNotAcceptable
} }
if r.Name == "" { if r.Name == "" {
r.Name = torrent.TorrentName() r.Name = torrent.TorrentName()