Skip to content

Commit

Permalink
Merge pull request #48 from humhub/fix/53-multiline-urls-go-service
Browse files Browse the repository at this point in the history
Fix go service for multiline links
  • Loading branch information
luke- authored Sep 2, 2024
2 parents 4a43def + 2627c97 commit 3ecab13
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

2.0.7 (Unreleased)
-----------------------
- Fix #48: Fix go service for multiline links

2.0.6 (August 25, 2024)
-----------------------
- Fix #41: Fix go service for multiline links
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"humhub": {
"minVersion": "1.14"
},
"version": "2.0.6",
"version": "2.0.7",
"screenshots": []
}
4 changes: 2 additions & 2 deletions services/GoService.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ private function callbackReplaceUrl($matches)
public function processLinks($text): ?string
{
return $this->isConfigured()
? preg_replace_callback('#(<a.+?href=")(' . $this->sitePattern . '.+?)(".*?>)#is', [$this, 'callbackReplaceLink'], $text)
? preg_replace_callback('#(<a.+?href=")(' . $this->sitePattern . '[^"\r\n]*)#is', [$this, 'callbackReplaceLink'], $text)
: $text;
}

private function callbackReplaceLink($matches)
{
return $matches[1] . $this->buildUrl($matches[2]) . $matches[3];
return $matches[1] . $this->buildUrl($matches[2]);
}

public function buildUrl(string $url): string
Expand Down

0 comments on commit 3ecab13

Please sign in to comment.