⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

plus sign(+) on image name cause bug



Lincoln Borges
  • profile picture
  • Member

Posted 17 June 2015 - 02:31 AM

Hello everyone, im new in this community, i would like to share a solution of a problem that happened with me.

 

When i upload a image (using image_moo) with a file that have a plus sign (+) on the name, will work, but bug when i try to delete i get Javascript Error 400 (Bad Request)

 

http://lnborges.com.br/bug.gif (gif showing the problem)

 

The solution that i found, is to modify the core and put str_replace on the _transliterate_characters function.

 

Now the function become.

    private function _transliterate_characters($file_name)
	{
		include($this->default_config_path.'/translit_chars.php');
		if ( ! isset($translit_characters))
		{
			return preg_replace("/([^a-zA-Z0-9\.\-\_]+?){1}/i", '-', $file_name);
		}
		$transformed_file_name = preg_replace(array_keys($translit_characters), array_values($translit_characters), $file_name);
		$transformed_file_name = str_replace("+", "-", $transformed_file_name); //new line, + to -
		return str_replace(" ", "-", $transformed_file_name);
	}

Sorry about bad english and thank you for grocerycrud project.  :wub: