have tag sanitisation process ignore tags which are too long, fixes #565
This commit is contained in:
parent
5691d1c3ad
commit
bcef3fbc8f
@ -1102,6 +1102,11 @@ class Tag {
|
|||||||
$tag = preg_replace("/^(\.+[\/\\\\])+/", "", $tag); # trailing slashes?
|
$tag = preg_replace("/^(\.+[\/\\\\])+/", "", $tag); # trailing slashes?
|
||||||
$tag = trim($tag, ", \t\n\r\0\x0B");
|
$tag = trim($tag, ", \t\n\r\0\x0B");
|
||||||
|
|
||||||
|
if(mb_strlen($tag, 'UTF-8') > 255){
|
||||||
|
flash_message("The tag below is longer than 255 characters, please use a shorter tag.\n$tag\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(!empty($tag)) {
|
if(!empty($tag)) {
|
||||||
$tag_array[] = $tag;
|
$tag_array[] = $tag;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,13 @@ class TagEditTest extends ShimmiePHPUnitTestCase {
|
|||||||
$this->log_out();
|
$this->log_out();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testTagEdit_tooLong() {
|
||||||
|
$this->log_in_as_user();
|
||||||
|
$image_id = $this->post_image("tests/pbx_screenshot.jpg", str_repeat("a", 500));
|
||||||
|
$this->get_page("post/view/$image_id");
|
||||||
|
$this->assert_title("Image $image_id: tagme");
|
||||||
|
}
|
||||||
|
|
||||||
public function testSourceEdit() {
|
public function testSourceEdit() {
|
||||||
$this->log_in_as_user();
|
$this->log_in_as_user();
|
||||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
|
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user