<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2">Hi,<div><br></div><div>I am uploading publications via sword, full text files are added to the upload xml and encoded in base64 this worked fine until we upgraded to 3.3. Now we get errors in the log:</div><div><br></div><div>&nbsp;failed: expected 3151 bytes but actually got 3149 bytes</div><div><br></div><div>So it seems the decoding of base64 is no longer working correctly. Inside EPrints/DataObj/File.pm the functions:&nbsp;end_element,&nbsp;characters and&nbsp;start_element seems to create a tmp file that is corrupt. &nbsp;If I add a write to file inside "sub characters" (see below) the pdf is created correctly so I know the data is passed in correctly, there seems to be something&nbsp;fundamentally&nbsp;broken with the way the decoding to tmpfile is working. Has anyone seen this are have a fix for it?</div><div><br></div><div><br></div><div><div>&nbsp;if( $state-&gt;{depth} == 2 &amp;&amp; defined $state-&gt;{encoding} )</div><div>&nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;my $tmpfile = $epdata-&gt;{_content};</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$state-&gt;{buffer} .= $data-&gt;{Data};</div><div><br></div><div>open (MYFILE, '&gt;&gt;/tmp/data2.pdf');</div><div>print MYFILE &nbsp;MIME::Base64::decode_base64($data-&gt;{Data});</div><div>close (MYFILE);</div><div><br></div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for($state-&gt;{buffer})</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #print $tmpfile MIME::Base64::decode_base64( substr($_,0,length($_) - length($_)%77) );</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $_ = substr($_,length($_) - length($_)%77);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div></div><div><br></div><div><br></div></font>