Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-09-10 13:00:11 +0300
committerTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-09-10 13:00:11 +0300
commit9977423ac9ac8b6a58d4602f808dccc3fa08428b (patch)
treeeb8fd8ace6f4180a48988adfe357b3d48b25b542
parenta96f9a78f30df440efa682bb84e0c96b247fa138 (diff)
Fix handling the projects with not updated configuration
-rw-r--r--app.go2
-rw-r--r--internal/domain/domain.go19
2 files changed, 20 insertions, 1 deletions
diff --git a/app.go b/app.go
index 32ce53a0..6edf0ae5 100644
--- a/app.go
+++ b/app.go
@@ -95,7 +95,7 @@ func (a *theApp) getHostAndDomain(r *http.Request) (host string, domain *domain.
}
func (a *theApp) checkAuthenticationIfNotExists(domain *domain.D, w http.ResponseWriter, r *http.Request) bool {
- if domain == nil || domain.GetID(r) == 0 {
+ if domain == nil || !domain.HasProject(r) {
// Only if auth is supported
if a.Auth.IsAuthSupported() {
diff --git a/internal/domain/domain.go b/internal/domain/domain.go
index 1ea008c4..2b6e83bd 100644
--- a/internal/domain/domain.go
+++ b/internal/domain/domain.go
@@ -173,6 +173,25 @@ func (d *D) GetID(r *http.Request) uint64 {
return 0
}
+// HasProject figures out if the project exists that the user tries to access
+func (d *D) HasProject(r *http.Request) bool {
+ if d == nil {
+ return false
+ }
+
+ if d.config != nil {
+ return true
+ }
+
+ project := d.getProject(r)
+
+ if project != nil {
+ return true
+ }
+
+ return false
+}
+
func (d *D) serveFile(w http.ResponseWriter, r *http.Request, origPath string) error {
fullPath := handleGZip(w, r, origPath)