From 584ba5c74d0af511260e7ab36af2d57e32ea9763 Mon Sep 17 00:00:00 2001
From: Moritz Marquardt <git@momar.de>
Date: Tue, 2 Apr 2024 21:04:40 +0200
Subject: [PATCH] Fix cached error when .domains is not readable (fixes
 https://codeberg.org/Codeberg/Community/issues/1512)

Co-authored-by: @algernon
---
 server/upstream/domains.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/upstream/domains.go b/server/upstream/domains.go
index b827966..7c7fafe 100644
--- a/server/upstream/domains.go
+++ b/server/upstream/domains.go
@@ -33,7 +33,8 @@ func (o *Options) CheckCanonicalDomain(giteaClient *gitea.Client, actualDomain,
 	body, err := giteaClient.GiteaRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, canonicalDomainConfig)
 	if err != nil && !errors.Is(err, gitea.ErrorNotFound) {
 		log.Error().Err(err).Msgf("could not read %s of %s/%s", canonicalDomainConfig, o.TargetOwner, o.TargetRepo)
-		// TODO: WTF we just continue?! Seems fine as body is empty... :/
+		// Assume that the domain is valid, as Gitea seems to be broken. Don't cache it though.
+		return actualDomain, true
 	}
 
 	var domains []string