Skip to content

Commit 39d035e

Browse files
CybotTMandreaskienast
authored andcommitted
[BUGFIX] Remove interpolation braces from Slack footer link
f055d02 moved the source URL into a constant and turned the footer into a sprintf() format. The braces around the placeholder are PHP interpolation syntax and only vanish inside a double quoted string, so Slack now receives `<{https://…/SlackService.php}|(?)>` and prints that verbatim instead of the "(?)" link. The existing footer assertions match substrings and pass on the broken markup, so the test additionally requires every link target in the text and in the footer to be a bare URL. Assisted-by: claude-code:claude-opus-5 Agent-Session: https://claude.ai/code/session_014H1xwaAmrQRWUA3vx8bJcD Agent-Host: 0493f0 Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
1 parent 1910d72 commit 39d035e

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/Service/SlackService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function sendRepositoryDiscoveryMessage(DocumentationJar $jar): ResponseI
6363
. ":hammer_and_wrench: *Maintainers:* <{$deploymentsUrl}|Review pending deployments> | <{$gitUrl}|:git:>\n"
6464
. ":information_source: *Extension authors:* <{$webhookDocsUrl}|How does this work?>",
6565
'fallback' => "Repository {$repoKey} is awaiting documentation approval at {$deploymentsUrl}",
66-
'footer' => sprintf("TYPO3 Intercept \u{00b7} <{%s}|(?)>", self::SOURCE_URL),
66+
'footer' => sprintf("TYPO3 Intercept \u{00b7} <%s|(?)>", self::SOURCE_URL),
6767
'footer_icon' => self::AVATAR_URL,
6868
'mrkdwn_in' => ['text'],
6969
],

tests/Functional/Service/SlackServiceTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ public function testSendRepositoryDiscoveryMessageContainsExpectedPayload(): voi
8989
self::assertStringContainsString('github.com/TYPO3GmbH/site-intercept', $attachment['footer']);
9090
self::assertStringContainsString('SlackService.php', $attachment['footer']);
9191

92+
// Every link target must be a bare URL, `<{https://…}|label>` is rendered verbatim by Slack
93+
foreach (['text', 'footer'] as $field) {
94+
preg_match_all('/<([^|>]*)\|[^>]*>/', $attachment[$field], $links);
95+
self::assertNotEmpty($links[1], sprintf('No Slack link found in attachment field "%s"', $field));
96+
foreach ($links[1] as $target) {
97+
self::assertMatchesRegularExpression('#^https?://\S+$#', $target);
98+
}
99+
}
100+
92101
// Must opt into mrkdwn rendering for the text field
93102
self::assertContains('text', $attachment['mrkdwn_in']);
94103

0 commit comments

Comments
 (0)