better handling of rogue newlines in ical files imported from other sources.

the legality of the presences of newlines inside an ical record is debatable, but
as we have seen, this can and will happen.

Fixes https://sourceforge.net/tracker/index.php?func=detail&aid=989070&group_id=78745&atid=554338
This commit is contained in:
mgalgoci 2004-08-19 18:36:33 +00:00
parent 338c962e71
commit efdf383dc4

View File

@ -2985,9 +2985,12 @@
{ {
$filename = $this->import_file(); $filename = $this->import_file();
$fp=fopen($filename,'rt'); $fp=fopen($filename,'rt');
$mime_msg = explode("\n",fread($fp, filesize($filename))); $mime_msg = fread($fp, filesize($filename));
fclose($fp); fclose($fp);
unlink($filename); unlink($filename);
$mime_msg = preg_replace("/(\r\n|\r)/", "\n", $mime_msg); /* dos2unix */
$mime_msg = preg_replace("/\n\n+/", "\n", $mime_msg); /* strip duplicate newlines */
$mime_msg = explode("\n",$mime_msg); /* explode the sanitized message itself */
} }
elseif(!$mime_msg) elseif(!$mime_msg)
{ {