Skip to content

Commit db7a46a

Browse files
committed
fix(AttachmentService): make regex in getAttachmentIdsFromContent more permissive
Signed-off-by: Peter Birrer <peter.birrer@optonic.com>
1 parent 5bcee97 commit db7a46a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/Service/AttachmentService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,9 @@ function ($node) use ($contentAttachmentFileIds, $contentAttachmentNames) {
608608
*/
609609
public static function getAttachmentIdsFromContent(string $content): array {
610610
$matches = [];
611-
// matches [ANY_CONSIDERED_CORRECT_BY_PHP-MARKDOWN](ANY_URL/f/FILE_ID[ (preview)]) and captures FILE_ID
611+
// matches [ANY_CONSIDERED_CORRECT_BY_PHP-MARKDOWN](ANY_URL/f/FILE_ID and captures FILE_ID
612612
preg_match_all(
613-
'/\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[\])*\])*\])*\])*\])*\])*\]\(\S+\/f\/(\d+)(?: \(preview\))?\)/',
613+
'/\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[\])*\])*\])*\])*\])*\])*\]\(\S+\/f\/(\d+)/',
614614
$content,
615615
$matches,
616616
PREG_SET_ORDER

0 commit comments

Comments
 (0)