MCPcopy Create free account

hub / github.com/Gridea-Pro/gridea-pro / functions

Functions1,756 in github.com/Gridea-Pro/gridea-pro

FunctionTestDoDownload_NoRetryOn404
4xx 非重试错误(404)应立即放弃,不再发起第二次请求。
backend/internal/facade/update_facade_test.go:674
FunctionTestDoDownload_RejectsThirdPartyRedirect
集成测:本地服务器发起 302 跳到非白名单域名;下载客户端必须拒绝。 注意:合入 #52(PR #80)后,doDownload 入口会先校验 URL 前缀, 所以本测试中 redirector.URL(非 github 前缀)会在到达重定向逻辑前就被拒绝。 这意味着本测试的"零 hit"保证由
backend/internal/facade/update_facade_test.go:409
FunctionTestDoDownload_RejectsUntrustedURL
非白名单 URL 必须在 doDownload 入口就被拒,不能打到网络。
backend/internal/facade/update_facade_test.go:316
FunctionTestDoDownload_RetriesOnTransient500
500 服务器首两次 503,第三次 200 —— doDownload 应在第 3 次尝试拿到成功。
backend/internal/facade/update_facade_test.go:630
FunctionTestDoHTTPWithRetry_4xxNotRetried
(t *testing.T)
backend/internal/deploy/httpretry_test.go:49
FunctionTestDoHTTPWithRetry_ContextCancelled
(t *testing.T)
backend/internal/deploy/httpretry_test.go:128
FunctionTestDoHTTPWithRetry_ExhaustedReturnsError
(t *testing.T)
backend/internal/deploy/httpretry_test.go:74
FunctionTestDoHTTPWithRetry_RespectsRetryAfter
(t *testing.T)
backend/internal/deploy/httpretry_test.go:98
FunctionTestDoHTTPWithRetry_RetriesOn5xxAndSucceeds
(t *testing.T)
backend/internal/deploy/httpretry_test.go:19
FunctionTestFindSumsAsset
(t *testing.T)
backend/internal/facade/update_facade_test.go:571
FunctionTestFtpMode
(t *testing.T)
backend/internal/domain/ftp_mode_test.go:5
FunctionTestGetGithubFileSHA_NotFound
404:明确的"文件不存在"信号 → 调用方可以安全走 create 路径
backend/internal/service/cdn_upload_sha_test.go:65
FunctionTestGetGithubFileSHA_RateLimited_DoesNotMasqueradeAsMissing
核心回归:撞二级限流(403)/ 429 / 5xx 时,必须返回非 nil 且非 errRemoteFileNotFound 的错误。否则 uploadToGitHub 会把它当成"文件不存在",走 create 路径对已有文件 发无 sha PUT —— 触发 GitHub 422(正是 iss
backend/internal/service/cdn_upload_sha_test.go:83
FunctionTestGetGithubFileSHA_RetriesThroughTransientFailures
核心回归 #2:stream cancel / 5xx / 403 等瞬时错误应该在 getGithubFileSHA 内部 透明重试。前两次 503、第三次 200 模拟 GitHub secondary rate limit 恢复过程。
backend/internal/service/cdn_upload_sha_test.go:119
FunctionTestGetGithubFileSHA_Success
200 + 有 sha:返回 (sha, nil) 供 uploadToGitHub 进入"对比跳过"路径
backend/internal/service/cdn_upload_sha_test.go:45
FunctionTestHasTrustedRedirectHost
─── 重定向域名白名单(#53 / PR #81) ────────────────────────────────────────
backend/internal/facade/update_facade_test.go:339
FunctionTestInjectKatexCSS_AlreadyHasLink
TestInjectKatexCSS_AlreadyHasLink 主题已经引了 katex CSS → 不重复注入。
backend/internal/engine/html_postprocessor_test.go:48
FunctionTestInjectKatexCSS_Disabled
TestInjectKatexCSS_Disabled 开关关 → 即使含公式也不注入(由主题自行负责)。
backend/internal/engine/html_postprocessor_test.go:39
FunctionTestInjectKatexCSS_NoMath
TestInjectKatexCSS_NoMath 不含公式 → 不注入(节省一个 stylesheet 请求)。
backend/internal/engine/html_postprocessor_test.go:30
FunctionTestInjectKatexCSS_WithMath
TestInjectKatexCSS_WithMath 含 KaTeX 公式且开关开 → 注入 katex.min.css 到 head。
backend/internal/engine/html_postprocessor_test.go:21
FunctionTestIsTransientDownloadErr
(t *testing.T)
backend/internal/facade/update_facade_test.go:600
FunctionTestIsTrustedDownloadURL
(t *testing.T)
backend/internal/facade/update_facade_test.go:291
FunctionTestKatexBlockRendered
TestKatexBlockRendered 块级公式 `$$\n...\n$$` 应该被渲染,且不嵌在 <p> 里。
backend/internal/utils/markdown_katex_test.go:21
FunctionTestKatexBlockSingleLine
TestKatexBlockSingleLine 单行 `$$ x $$` 也应该被识别成块级。
backend/internal/utils/markdown_katex_test.go:35
FunctionTestKatexCacheReuse
TestKatexCacheReuse 第二次渲染同一公式应该走缓存(耗时显著小于第一次)。
backend/internal/utils/markdown_katex_test.go:95
FunctionTestKatexCrossLineInlineRejected
TestKatexCrossLineInlineRejected 跨行的 `$x\n$` 不应该被当公式。
backend/internal/utils/markdown_katex_test.go:79
FunctionTestKatexInlineDisplayInParagraph
TestKatexInlineDisplayInParagraph 同行 `$$x$$` 在段落里应该用 display 模式渲染。
backend/internal/utils/markdown_katex_test.go:87
FunctionTestKatexInlineRendered
TestKatexInlineRendered 行内公式 `$x$` 应该被渲染成 KaTeX HTML。
backend/internal/utils/markdown_katex_test.go:9
FunctionTestKatexInlineWhitespaceBoundary
TestKatexInlineWhitespaceBoundary `$ x$` 和 `$x $` 都不应该开/闭公式。
backend/internal/utils/markdown_katex_test.go:65
FunctionTestKatexInsideCodeBlockNotRendered
TestKatexInsideCodeBlockNotRendered 代码块里的 `$x$` 不应该被渲染成公式。
backend/internal/utils/markdown_katex_test.go:56
FunctionTestKatexLiteralDollarNotConsumed
TestKatexLiteralDollarNotConsumed issue 108 同类回归保护: `It costs $10 and $20.` 这种字面美元符号不能被当成公式起点吞掉。
backend/internal/utils/markdown_katex_test.go:44
FunctionTestMatchAssetExt
(t *testing.T)
backend/internal/facade/update_facade_test.go:144
FunctionTestMemoListReturnsCopy
(t *testing.T)
backend/internal/repository/memo_repo_test.go:126
FunctionTestMemoListSortedByCreatedAtDesc
(t *testing.T)
backend/internal/repository/memo_repo_test.go:14
FunctionTestMemoLoadAcceptsLegacyRFC3339
(t *testing.T)
backend/internal/repository/memo_repo_test.go:83
FunctionTestMemoSaveUsesRFC3339WithLocalOffset
(t *testing.T)
backend/internal/repository/memo_repo_test.go:50
FunctionTestNormalizeFileName
TestNormalizeFileName 验证 repo 入口归一:去掉末尾 .md(含历史遗留的多重 .md), 大小写敏感(只剥小写 .md,与 save 补的小写 .md 对齐),中间的 .md 保留。 这是 #122 的核心——保证 repo 内部 FileName 始终是裸名。
backend/internal/repository/post_repo_test.go:8
FunctionTestNormalizeFileName
TestNormalizeFileName verifies that normalizeFileName strips any trailing ".md" extension(s) so callers can pass either "hello-world" or "hello-world.
backend/internal/mcp/tool_post_test.go:12
FunctionTestParseRetryAfter
(t *testing.T)
backend/internal/deploy/httpretry_test.go:148
FunctionTestParseSha256Sums
─── SHA256 完整性校验(#54 / PR #82) ────────────────────────────────────────
backend/internal/facade/update_facade_test.go:441
FunctionTestParseVercelDeployBody
(t *testing.T)
backend/internal/deploy/vercel_deployer_test.go:8
FunctionTestPickAsset_BinaryWhitelist
(t *testing.T)
backend/internal/facade/update_facade_test.go:30
FunctionTestPollDeployStatus_ContextCancelled
(t *testing.T)
backend/internal/deploy/netlify_poll_test.go:110
FunctionTestPollDeployStatus_ErrorState
(t *testing.T)
backend/internal/deploy/netlify_poll_test.go:66
FunctionTestPollDeployStatus_Unauthorized
(t *testing.T)
backend/internal/deploy/netlify_poll_test.go:87
FunctionTestPollDeployStatus_UploadingProcessingReady
(t *testing.T)
backend/internal/deploy/netlify_poll_test.go:41
FunctionTestRenderSimpleIndex_EmptyPostsStillWritesIndex
(t *testing.T)
backend/internal/engine/page_renderer_test.go:146
FunctionTestRenderSimpleIndex_HidesUnpublished
(t *testing.T)
backend/internal/engine/page_renderer_test.go:115
FunctionTestRenderSimpleIndex_Pagination
(t *testing.T)
backend/internal/engine/page_renderer_test.go:34
FunctionTestRenderSimplePost_RegularPost
(t *testing.T)
backend/internal/engine/page_renderer_test.go:205
FunctionTestRenderSimplePost_SpecialPage
(t *testing.T)
backend/internal/engine/page_renderer_test.go:162
FunctionTestSettingRepository_GetSettingReturnsDeepClone
核心回归场景(#39):调用方在 GetSetting 返回值上 InjectCredentials 注入 token, 再次 GetSetting 不应看到这个 token —— 前端侧永远拿不到敏感字段。
backend/internal/repository/setting_repo_test.go:14
FunctionTestSettingRepository_SaveSettingDecouplesFromInput
Save 阶段也要走 Clone:调用方保存后继续修改入参 map,不应影响 cache。
backend/internal/repository/setting_repo_test.go:51
FunctionTestSetting_Clone_IndependentPlatformConfigs
(t *testing.T)
backend/internal/domain/setting_test.go:5
FunctionTestSetting_Clone_NilPlatformConfigsStaysNil
(t *testing.T)
backend/internal/domain/setting_test.go:46
FunctionTestSetting_Clone_PreservesOtherFields
(t *testing.T)
backend/internal/domain/setting_test.go:34
FunctionTestSetting_InjectCredentialsOnClone_DoesNotLeakIntoOriginal
核心回归:InjectCredentials 注入 token 后,只影响传入的 setting,不污染原始 map。
backend/internal/domain/setting_test.go:55
FunctionTestSha256File
(t *testing.T)
backend/internal/facade/update_facade_test.go:475
FunctionTestSlugifyName
(t *testing.T)
backend/internal/utils/slug_test.go:8
FunctionTestSlugifyName_OutputPassesValidateSlug
SlugifyName 产出的所有 slug 都必须满足 ValidateSlug —— 这是两个函数之间的约定。
backend/internal/utils/slug_test.go:104
FunctionTestSniffJinja2FromHTMLFiles
(t *testing.T)
backend/internal/render/factory_test.go:119
FunctionTestStartDownload_ClearsPreviousReadyState
关键修复:连续两次下载(第一次成功、第二次失败)后,readyPath 不应指向第一次的文件。
backend/internal/facade/update_facade_test.go:199
FunctionTestTOFU_DifferentHostsIsolated
不同 host 互不影响
backend/internal/deploy/sftp_host_key_test.go:115
FunctionTestTOFU_FallsBackToInMemoryWhenPathEmpty
(t *testing.T)
backend/internal/deploy/sftp_host_key_test.go:98
FunctionTestTOFU_FingerprintChangeRejected
(t *testing.T)
backend/internal/deploy/sftp_host_key_test.go:77
FunctionTestTOFU_FirstConnectTrustsAndPersists
(t *testing.T)
backend/internal/deploy/sftp_host_key_test.go:35
FunctionTestTOFU_SecondConnectWithSameKeyAccepted
(t *testing.T)
backend/internal/deploy/sftp_host_key_test.go:62
FunctionTestTagRepository_Create_RejectsCaseInsensitiveDuplicateName
Issue #99:仅大小写不同的 Name / Slug 在 macOS/Windows 默认大小写不敏感的 文件系统上会互相覆盖页面,必须判重。
backend/internal/repository/uniqueness_test.go:77
FunctionTestTagRepository_Create_RejectsCaseInsensitiveDuplicateSlug
(t *testing.T)
backend/internal/repository/uniqueness_test.go:91
FunctionTestTagRepository_Create_RejectsDuplicateName
─── Tag 唯一性检查 ───────────────────────────────────────────────────────────
backend/internal/repository/uniqueness_test.go:25
FunctionTestTagRepository_Create_RejectsDuplicateSlug
(t *testing.T)
backend/internal/repository/uniqueness_test.go:42
FunctionTestTagRepository_Update_AllowsSelf
(t *testing.T)
backend/internal/repository/uniqueness_test.go:59
FunctionTestTagRepository_Update_RejectsCollisionWithOther
(t *testing.T)
backend/internal/repository/uniqueness_test.go:105
FunctionTestTrustedRedirectChecker
(t *testing.T)
backend/internal/facade/update_facade_test.go:366
FunctionTestUploadResult_Shape
(t *testing.T)
backend/internal/service/deploy_service_cdn_test.go:46
FunctionTestValidateSlug
(t *testing.T)
backend/internal/utils/slug_test.go:48
FunctionTestVerifyDownloadChecksum_AssetNotInSums
(t *testing.T)
backend/internal/facade/update_facade_test.go:549
FunctionTestVerifyDownloadChecksum_HashMatches
(t *testing.T)
backend/internal/facade/update_facade_test.go:504
FunctionTestVerifyDownloadChecksum_HashMismatchFails
(t *testing.T)
backend/internal/facade/update_facade_test.go:527
FunctionTestVerifyDownloadChecksum_NoSumsAssetReturnsNil
(t *testing.T)
backend/internal/facade/update_facade_test.go:494
FunctionTestWriteFileAtomic_MarksSelfWrite
WriteFileAtomic 调用完后,目标路径立刻被标记成 self-write。 这是 ResourceWatcher 过滤自激事件的契约入口。
backend/internal/repository/write_gate_test.go:46
FunctionTestWriteGate_HitAndConsume
(t *testing.T)
backend/internal/repository/write_gate_test.go:10
FunctionTestWriteGate_MissUnknownPath
(t *testing.T)
backend/internal/repository/write_gate_test.go:23
FunctionTestWriteGate_TTLExpiry
(t *testing.T)
backend/internal/repository/write_gate_test.go:31
MethodTrigger
()
backend/internal/utils/markdown_katex.go:85
MethodTrigger
()
backend/internal/utils/markdown_katex.go:157
MethodUnmarshalJSON
UnmarshalJSON 自定义反序列化:对老配置(缺 katexEnabled 字段)默认开 KaTeX。 这样从 v1.2.0 之前升级过来的站点不需要手动到主题设置里打开开关。
backend/internal/domain/theme.go:59
MethodUnmarshalJSON
UnmarshalJSON 自定义反序列化逻辑,专治历史技术债
backend/internal/domain/post.go:48
MethodUpdate
(ctx context.Context, id string, memo *domain.Memo)
backend/internal/repository/memo_repo.go:204
MethodUpdate
(ctx context.Context, post *domain.Post)
backend/internal/repository/post_repo.go:58
MethodUpdate
(ctx context.Context, tag *domain.Tag)
backend/internal/repository/tag_repo.go:39
MethodUpdate
(ctx context.Context, id string, link *domain.Link)
backend/internal/repository/link_repo.go:32
MethodUpdate
(ctx context.Context, id string, menu *domain.Menu)
backend/internal/repository/menu_repo.go:32
MethodUpdate
(ctx context.Context, id string, category *domain.Category)
backend/internal/repository/category_repo.go:41
MethodUpdate
Update 更新条目
backend/internal/repository/base_json_repo.go:162
MethodUpdate
Update 更新菜单
backend/internal/domain/menu.go:35
MethodUpdate
Update 更新分类(按 ID 查找)
backend/internal/domain/category.go:33
MethodUpdate
Update 更新闪念
backend/internal/domain/memo.go:34
MethodUpdate
(ctx context.Context, post *Post)
backend/internal/domain/post.go:83
MethodUpdate
Update 更新友链
backend/internal/domain/link.go:35
← previousnext →1,401–1,500 of 1,756, ranked by callers