Skip to content

Commit a4b8f7d

Browse files
jonradoffclaude
andcommitted
Fix two CI test failures
- UpdateWikilinksOnRename: remove broken $regex pre-filter on the nested `data` document (MongoDB doesn't traverse into sub-fields with a top-level $regex, so the filter matched nothing and no wikilinks were rewritten). Renamed items now correctly update all referencing pages via a full non-deleted scan, as the operation is rename-only. - TestDefaultCloudConfig: update assertion from TrustAllProxies to TrustFlyProxy to match the v4.2.0 security hardening change that switched DefaultCloudConfig() to use the unspoofable Fly-Client-IP header instead of X-Forwarded-For. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1881d9a commit a4b8f7d

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

internal/middleware/security_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ func TestDefaultCloudConfig(t *testing.T) {
309309
if cfg == nil {
310310
t.Fatal("expected non-nil config")
311311
}
312-
if !cfg.TrustAllProxies {
313-
t.Error("expected TrustAllProxies=true for cloud config")
312+
if !cfg.TrustFlyProxy {
313+
t.Error("expected TrustFlyProxy=true for cloud config")
314314
}
315315
}
316316

internal/services/content.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,19 +1314,7 @@ func (s *ContentService) UpdateWikilinksOnRename(ctx context.Context, oldTitle,
13141314
return
13151315
}
13161316

1317-
// Build a $regex pre-filter to only scan documents that are likely to contain the old reference.
1318-
// This avoids a full collection scan when only a small fraction of pages reference the renamed item.
1319-
var orConditions []bson.M
1320-
if oldTitle != "" && oldTitle != newTitle {
1321-
orConditions = append(orConditions, bson.M{"data": bson.M{"$regex": regexp.QuoteMeta("[[" + oldTitle)}})
1322-
}
1323-
if oldPath != "" && oldPath != newPath {
1324-
orConditions = append(orConditions, bson.M{"data": bson.M{"$regex": regexp.QuoteMeta("[[" + oldPath)}})
1325-
}
13261317
filter := bson.M{"deleted": bson.M{"$ne": true}}
1327-
if len(orConditions) > 0 {
1328-
filter["$or"] = orConditions
1329-
}
13301318

13311319
// Stream documents one-by-one to avoid loading the entire collection into memory.
13321320
cursor, err := s.db.FindMany(ctx, "content", filter)

0 commit comments

Comments
 (0)