0

We have recently observed some problems when transferring specific image files with Mina-core 2.0.9 and ftp-server-core 1.0.9. After uploading an FPO file (which is type of lowres OPI file), the file is truncated on the FTP server and we can’t open it anymore. Other image files, such as standard JPEG, are fine. We presume the root cause might be that these FPO files start with a clear-text meta-data section before the actual binary data and therefore the FPT transfer might be carried out differently (see below). The problem might be related to ASCII vs. Binary transfer mode.

Could this plaintext be the cause? Has anyone else had similar problems with this file type? Is there a way to tell the FTP server to use only binary mode or, even better, to set the transfer for specific file types? We have tried setting the binary mode explicitly with FileZilla and FTP command line tool, without any effect.

%!PS-Adobe-3.0 EPSF-3.0
%%Creator: FullPress
%%BoundingBox: 0 0 480 480
%%HiResBoundingBox: 0 0 480.0000 480.0000
%%DocumentProcessColors: Cyan Magenta Yellow Black
%%EndComments
%ImageData: 480 480 8 4 0 1 6 "exec"
%BeginPhotoshop: 14
% 3842494D040A0000000000010000
%EndPhotoshop
[...]
%%BeginBinary:     255562
exec
s4IA>!"M;*Ddm8XA,lT0!!*&R!(-_f!<E3%!<N9&!<N<(!WiK,!WiE)"U"r1"9o#6
"pP58"pP;=#R1M?#6kA<$O@%G$47+I"pbSF$OR:K$47.?^]5&S!T4":"@Eb$9b@A.
&HGH9!<9t;*rl9A"T\W)!<E3$z!!!!"!WrQ/"pYD?$4HmP!4<@<!W`B*!X&T/"U"r.
!!.KK!WrE*&Hrdj0gQ!W;.0\RE>10ZOeE%*6F"?A;UOtZ1LbBV#mqFa(`=5<-7:2j
.Ps"@2`NfY6UX@47n?3D;cHat='/U/@q9._B4u!oF*)PJGBeCZK7nr5LPUeEP*;,q
QC!u,R\HRQV5C/hWN*81['d?O\@K2f_o0O6a2lBFdaQ^rf%8R-
CodeCaster
  • 147,647
  • 23
  • 218
  • 272
martin_wun
  • 1,599
  • 1
  • 15
  • 33
  • _"Could this plaintext be the cause?"_ - what transfer mode is used, which I'm sure can be obtained from either client or server logs? – CodeCaster Mar 17 '16 at 11:39
  • First, we were using ASCII mode, which is the default. But then switched to binary transfer mode and the problem is still the same. I wondering, if the Apache FTP server is trying to be clever and somehow overrides the binary mode set by the client when it detects the plain text section. – martin_wun Mar 17 '16 at 13:06
  • Just in case it sheds more light on this, the error message in Photoshop is the following: "Could not complete your request because a JPEG marker segment length is too short (the file may be truncated or incomplete)." (after downloading the uplaoded file; strangely enough, both files are identical on the byte level!) – martin_wun Mar 17 '16 at 14:12
  • Well you can always use a diff tool to see the differences between an original and a transferred file. – CodeCaster Mar 17 '16 at 14:14
  • @CodeCaster That's the puzzling thing: Diff tools show no difference at all between the two files (tried with DiffMerge and dhex). – martin_wun Mar 17 '16 at 15:00
  • If there's no single bit that's different, then the file transfer is not the problem. Perhaps the application on the receiving end is missing a plugin to properly open that file type or whatever. – CodeCaster Mar 17 '16 at 15:09
  • Is it possible that the diff is using ignore whitespace when comparing? Could you do a sha256 on both files and see if the hash matches? Also how are you pulling the file back? Could pulling the file back re-convert the EOLs to make it look the same? Also.. can you upload a sample test file that I can analyse to see if the final format is indeed broken or not? – chkdsk Mar 17 '16 at 16:39
  • Unfortunately, I can't share the specific files in question. We did do an MD5 comarison and the hash came out the exact same. At the moment, I am trying to get more test files. So, no conclusion, yet, I'm afraid. – martin_wun Mar 18 '16 at 13:07

1 Answers1

0

I would recommend that when doing FTP transfers always zip the file (even if it means you STORE instead of COMPRESS inside the zip container). This is very valuable as when unzipping at the target location the unzip tool will let you know if something broke during transfer.

If after transfer unzip succeeds without errors you can eliminate the transfer process and concentrate on the environment where you are using the file.

chkdsk
  • 1,187
  • 6
  • 20