Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2022-05-23 20:10:59 +0300
committerJulien Veyssier <eneiluj@posteo.net>2022-05-23 20:13:06 +0300
commit1715a7cadf2c36f5d2af65f23b4afc31f13158c7 (patch)
tree0c8dc974e168b4c2558123af86f741f7bf738fdb /lib
parentb95deb975414b44e953608aa89518cb0dfcaa17e (diff)
move test, add comments for cleanup regexps
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/ImageService.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Service/ImageService.php b/lib/Service/ImageService.php
index 7d047550a..901575355 100644
--- a/lib/Service/ImageService.php
+++ b/lib/Service/ImageService.php
@@ -485,6 +485,7 @@ class ImageService {
// simple version with .+ between the brackets
// '/\!\[.+\]\(text:\/\/image\?[^)]*imageFileName=([^)&]+)\)/',
// complex version of php-markdown
+ // matches ![ANY_CONSIDERED_CORRECT_BY_PHP-MARKDOWN](text://image?ANYTHING&imageFileName=FILE_NAME) and captures FILE_NAME
'/\!\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[\])*\])*\])*\])*\])*\])*\]\(text:\/\/image\?[^)]*imageFileName=([^)&]+)\)/',
$content,
$oldMatches,
@@ -495,6 +496,7 @@ class ImageService {
}, $oldMatches);
$matches = [];
+ // matches ![ANY_CONSIDERED_CORRECT_BY_PHP-MARKDOWN](.attachments.DOCUMENT_ID/ANY_FILE_NAME) and captures FILE_NAME
preg_match_all(
'/\!\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[(?>[^\[\]]+|\[\])*\])*\])*\])*\])*\])*\]\(\.attachments\.'.$fileId.'\/([^)&]+)\)/',
$content,