diff --git a/assets/js/photo.js b/assets/js/photo.js index a6f5d98..ef90cf8 100644 --- a/assets/js/photo.js +++ b/assets/js/photo.js @@ -408,7 +408,7 @@ photo = { // Parse tags tags = tags.replace(/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/g, ','); - tags = tags.replace(/,$|^,/g, ''); + tags = tags.replace(/,$|^,|(\ ){0,}$/g, ''); if (visible.photo()) { photo.json.tags = tags; diff --git a/php/modules/Photo.php b/php/modules/Photo.php index d43f094..76e44b0 100755 --- a/php/modules/Photo.php +++ b/php/modules/Photo.php @@ -639,7 +639,7 @@ class Photo extends Module { # Parse tags $tags = preg_replace('/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/', ',', $tags); - $tags = preg_replace('/,$|^,/', ',', $tags); + $tags = preg_replace('/,$|^,|(\ ){0,}$/', '', $tags); if (strlen($tags)>1000) return false; # Set tags