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:
authorVladimir Shushlin <vshushlin@gitlab.com>2019-06-12 19:13:54 +0300
committerNick Thomas <nick@gitlab.com>2019-06-12 19:13:54 +0300
commit02558f71efd57858d9301416964769f2896e62fd (patch)
treecea042a08686ef075d8ea047599a927fceb74a31 /internal/domain
parentc6555c057a745608f8150ee7c7f3625c270bc301 (diff)
Resolve "Pages incorrectly serve acme-challenges with /index.html"
Diffstat (limited to 'internal/domain')
-rw-r--r--internal/domain/domain.go6
-rw-r--r--internal/domain/domain_test.go10
2 files changed, 16 insertions, 0 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go
index 4ce8a561..eeb5519d 100644
--- a/internal/domain/domain.go
+++ b/internal/domain/domain.go
@@ -186,6 +186,12 @@ func (d *D) HasAcmeChallenge(token string) bool {
return true
}
+ _, err = d.resolvePath(d.projectName, ".well-known/acme-challenge", token, "index.html")
+
+ if err == nil {
+ return true
+ }
+
return false
}
diff --git a/internal/domain/domain_test.go b/internal/domain/domain_test.go
index a05dbe7e..14e399ad 100644
--- a/internal/domain/domain_test.go
+++ b/internal/domain/domain_test.go
@@ -226,6 +226,16 @@ func TestHasAcmeChallenge(t *testing.T) {
expected: true,
},
{
+ name: "Project containing acme challenge",
+ domain: &D{
+ group: group{name: "group.acme"},
+ projectName: "with.acme.challenge",
+ config: &domainConfig{HTTPSOnly: true},
+ },
+ token: "foldertoken",
+ expected: true,
+ },
+ {
name: "Project containing another token",
domain: &D{
group: group{name: "group.acme"},