X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2Fhttp%2FHttpUtils.php;h=ed1002b04770b1e5628581c8f9046b96c5cc950c;hb=b3bd8c3e8d367975980043e772f7cd78b7f96bc6;hp=28c129696b45b303c2cb21d29227f600551540d4;hpb=48df9f45b8c4b2995c1e04146071628668531b37;p=github%2Fshaarli%2FShaarli.git diff --git a/application/http/HttpUtils.php b/application/http/HttpUtils.php index 28c12969..ed1002b0 100644 --- a/application/http/HttpUtils.php +++ b/application/http/HttpUtils.php @@ -550,7 +550,8 @@ function get_curl_download_callback( &$title, &$description, &$keywords, - $retrieveDescription + $retrieveDescription, + $tagsSeparator ) { $currentChunk = 0; $foundChunk = null; @@ -568,6 +569,7 @@ function get_curl_download_callback( */ return function ($ch, $data) use ( $retrieveDescription, + $tagsSeparator, &$charset, &$title, &$description, @@ -598,10 +600,10 @@ function get_curl_download_callback( if (! empty($keywords)) { $foundChunk = $currentChunk; // Keywords use the format tag1, tag2 multiple words, tag - // So we format them to match Shaarli's separator and glue multiple words with '-' - $keywords = implode(' ', array_map(function($keyword) { - return implode('-', preg_split('/\s+/', trim($keyword))); - }, explode(',', $keywords))); + // So we split the result with `,`, then if a tag contains the separator we replace it by `-`. + $keywords = tags_array2str(array_map(function(string $keyword) use ($tagsSeparator): string { + return tags_array2str(tags_str2array($keyword, $tagsSeparator), '-'); + }, tags_str2array($keywords, ',')), $tagsSeparator); } }