From fff53fcb5b00a646a029173b9f4b311078ed06d0 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Sat, 20 May 2017 17:16:48 +0200 Subject: [PATCH] Website link are mandatory --- router/upload.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/router/upload.go b/router/upload.go index b8027cee..ef9eea78 100644 --- a/router/upload.go +++ b/router/upload.go @@ -122,11 +122,12 @@ func (f *UploadForm) ExtractInfo(r *http.Request) error { } else { return ErrInvalidTorrentCategory } - - // WebsiteLink - urlRegexp, _ := regexp.Compile(`^(https?:\/\/|irc:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$`) - if !urlRegexp.MatchString(f.WebsiteLink) { - return ErrInvalidWebsiteLink + if f.WebsiteLink != "" { + // WebsiteLink + urlRegexp, _ := regexp.Compile(`^(https?:\/\/|irc:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$`) + if !urlRegexp.MatchString(f.WebsiteLink) { + return ErrInvalidWebsiteLink + } } // first: parse torrent file (if any) to fill missing information