From 926e75d72126be97f9974976abfb46449a53f3c6 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 20 Feb 2016 17:32:34 -0500 Subject: #2334 strip whitespace for migrate URL Also fix a possible race condition while install --- modules/auth/repo_form.go | 2 +- modules/mailer/mailer.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index bd68feafcf..333f468a1c 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -57,7 +57,7 @@ func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) bi // It also checks if given user has permission when remote address // is actually a local path. func (f MigrateRepoForm) ParseRemoteAddr(user *models.User) (string, error) { - remoteAddr := f.CloneAddr + remoteAddr := strings.TrimSpace(f.CloneAddr) // Remote address can be HTTP/HTTPS/Git URL or local path. if strings.HasPrefix(remoteAddr, "http://") || diff --git a/modules/mailer/mailer.go b/modules/mailer/mailer.go index eafe04680a..e1c453a22e 100644 --- a/modules/mailer/mailer.go +++ b/modules/mailer/mailer.go @@ -197,7 +197,10 @@ func processMailQueue() { var mailQueue chan *Message func NewContext() { - if setting.MailService == nil { + // Need to check if mailQueue is nil because in during reinstall (user had installed + // before but swithed install lock off), this function will be called again + // while mail queue is already processing tasks, and produces a race condition. + if setting.MailService == nil || mailQueue != nil { return } -- cgit v1.2.3