diff --git a/lib/Service/Html.php b/lib/Service/Html.php
index 4edd967a74..243d610e0a 100755
--- a/lib/Service/Html.php
+++ b/lib/Service/Html.php
@@ -70,6 +70,7 @@ public function convertLinks(string $data): string {
$linker = new UrlLinker([
'allowFtpAddresses' => true,
'allowUpperCaseUrlSchemes' => false,
+ 'skipAmbiguousTlds' => true,
'htmlLinkCreator' => static fn ($url)
// Render full url for the link description. Otherwise, potentially malicious query
// params might be hidden.
diff --git a/tests/Unit/Service/HtmlTest.php b/tests/Unit/Service/HtmlTest.php
index 15b13b8aae..7866f8c9e6 100644
--- a/tests/Unit/Service/HtmlTest.php
+++ b/tests/Unit/Service/HtmlTest.php
@@ -97,6 +97,19 @@ public function testLinkDetectionLeavesValidMultibyteTextUnchanged(): void {
self::assertStringContainsString("\u{1F609}", $withLinks);
}
+ public function testDoNotLinkAmbiguousExtensions(): void {
+ $urlGenerator = Server::get(IURLGenerator::class);
+ $request = Server::get(IRequest::class);
+ $hmacGenerator = $this->createStub(ProxyHmacGenerator::class);
+
+ $html = new Html($urlGenerator, $request, $hmacGenerator);
+ $text = '/home/user/something/text.java';
+ $result = $html->convertLinks($text);
+
+ self::assertStringContainsString('/home/user/something/text.java', $result);
+ $this->assertStringNotContainsString('http', $result);
+ }
+
/**
* @dataProvider parseMailBodyProvider
* @param $expected