diff options
author | Chris Kuethe <chris.kuethe@gmail.com> | 2016-05-19 11:33:45 -0700 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-08-02 10:22:18 +0200 |
commit | 4b35853d6869e65b473fec065361e9ea7dbcf94d (patch) | |
tree | 203b6be948d3c92e0b42a6868a709c7fd20e07c1 /application/LinkDB.php | |
parent | efc0c865ba914e75a6c3c9220450d13f752c7afa (diff) | |
download | Shaarli-4b35853d6869e65b473fec065361e9ea7dbcf94d.tar.gz Shaarli-4b35853d6869e65b473fec065361e9ea7dbcf94d.tar.zst Shaarli-4b35853d6869e65b473fec065361e9ea7dbcf94d.zip |
Better whitespace handling in tags. Fixes #571
Diffstat (limited to 'application/LinkDB.php')
-rw-r--r-- | application/LinkDB.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php index 929a6b0f..e9d216ea 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -291,7 +291,7 @@ You use the community supported version of the original Shaarli project, by Seba | |||
291 | 291 | ||
292 | // Remove private tags if the user is not logged in. | 292 | // Remove private tags if the user is not logged in. |
293 | if (! $this->_loggedIn) { | 293 | if (! $this->_loggedIn) { |
294 | $link['tags'] = preg_replace('/(^| )\.[^($| )]+/', '', $link['tags']); | 294 | $link['tags'] = preg_replace('/(^|\s*)\.[^($| )]+\s*$/', '', $link['tags']); |
295 | } | 295 | } |
296 | 296 | ||
297 | // Do not use the redirector for internal links (Shaarli note URL starting with a '?'). | 297 | // Do not use the redirector for internal links (Shaarli note URL starting with a '?'). |
@@ -442,7 +442,7 @@ You use the community supported version of the original Shaarli project, by Seba | |||
442 | $tags = array(); | 442 | $tags = array(); |
443 | $caseMapping = array(); | 443 | $caseMapping = array(); |
444 | foreach ($this->_links as $link) { | 444 | foreach ($this->_links as $link) { |
445 | foreach (explode(' ', $link['tags']) as $tag) { | 445 | foreach (preg_split('/\s+/', $link['tags'], 0, PREG_SPLIT_NO_EMPTY) as $tag) { |
446 | if (empty($tag)) { | 446 | if (empty($tag)) { |
447 | continue; | 447 | continue; |
448 | } | 448 | } |