Skip to content

Move witness API path component into gateway implementation - #1072

Merged
AlCutter merged 1 commit into
transparency-dev:mainfrom
AlCutter:witness_api_tidy
Jul 23, 2026
Merged

Move witness API path component into gateway implementation#1072
AlCutter merged 1 commit into
transparency-dev:mainfrom
AlCutter:witness_api_tidy

Conversation

@AlCutter

Copy link
Copy Markdown
Collaborator

Move the witness API path detail out of the policy code and into the gateway implementation.

The witness policy handling code shouldn't care about the individual API path(s) on a witness, just its root URL.

Towards #945

@AlCutter
AlCutter requested a review from roger2hk July 23, 2026 11:46
@AlCutter
AlCutter requested a review from a team as a code owner July 23, 2026 11:46
Comment on lines +128 to +131
// Can't use path.Join here as it'll nobble the double-slash in URLs.
// url.JoinPath returns an error, which we can't handle here, but we already know that the URL is valid since
// it's coming via WitnessGroup.WitnessEndpoints(). So we'll just do the string manipulation ourselves.
url: strings.TrimRight(u, "/") + "/add-checkpoint",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the / be trimmed in WitnessGroup.WitnessEndpoints()? This would ensure all URLs are aligned at the source.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems more correct to do it here; if it weren't for the potential to return an error, I'd have just used url.JoinPath here which would have done this normalisation internally.

@AlCutter
AlCutter merged commit 3468bb9 into transparency-dev:main Jul 23, 2026
20 checks passed
@AlCutter
AlCutter deleted the witness_api_tidy branch July 23, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants