Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Service/SlackService.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function sendRepositoryDiscoveryMessage(DocumentationJar $jar): ResponseI
. ":hammer_and_wrench: *Maintainers:* <{$deploymentsUrl}|Review pending deployments> | <{$gitUrl}|:git:>\n"
. ":information_source: *Extension authors:* <{$webhookDocsUrl}|How does this work?>",
'fallback' => "Repository {$repoKey} is awaiting documentation approval at {$deploymentsUrl}",
'footer' => sprintf("TYPO3 Intercept \u{00b7} <{%s}|(?)>", self::SOURCE_URL),
'footer' => sprintf("TYPO3 Intercept \u{00b7} <%s|(?)>", self::SOURCE_URL),
'footer_icon' => self::AVATAR_URL,
'mrkdwn_in' => ['text'],
],
Expand Down
9 changes: 9 additions & 0 deletions tests/Functional/Service/SlackServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ public function testSendRepositoryDiscoveryMessageContainsExpectedPayload(): voi
self::assertStringContainsString('github.com/TYPO3GmbH/site-intercept', $attachment['footer']);
self::assertStringContainsString('SlackService.php', $attachment['footer']);

// Every link target must be a bare URL, `<{https://…}|label>` is rendered verbatim by Slack
foreach (['text', 'footer'] as $field) {
preg_match_all('/<([^|>]*)\|[^>]*>/', $attachment[$field], $links);
self::assertNotEmpty($links[1], sprintf('No Slack link found in attachment field "%s"', $field));
foreach ($links[1] as $target) {
self::assertMatchesRegularExpression('#^https?://\S+$#', $target);
}
}

// Must opt into mrkdwn rendering for the text field
self::assertContains('text', $attachment['mrkdwn_in']);

Expand Down