Author: toad
Date: 2006-08-16 19:49:54 +0000 (Wed, 16 Aug 2006)
New Revision: 10127

Modified:
   trunk/freenet/src/freenet/node/fcp/ClientPut.java
Log:
If no MIME type specified in an FCP insert, but filename is, then pick it up 
from the filename.

Modified: trunk/freenet/src/freenet/node/fcp/ClientPut.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientPut.java   2006-08-16 19:43:19 UTC 
(rev 10126)
+++ trunk/freenet/src/freenet/node/fcp/ClientPut.java   2006-08-16 19:49:54 UTC 
(rev 10127)
@@ -4,6 +4,7 @@
 import java.io.IOException;

 import freenet.client.ClientMetadata;
+import freenet.client.DefaultMIMETypes;
 import freenet.client.InserterException;
 import freenet.client.Metadata;
 import freenet.client.MetadataUnresolvedException;
@@ -126,6 +127,9 @@
                this.origFilename = message.origFilename;
                // Now go through the fields one at a time
                String mimeType = message.contentType;
+               if(mimeType == null && origFilename != null) {
+                       mimeType = 
DefaultMIMETypes.guessMIMEType(origFilename.getName());
+               }
                clientToken = message.clientToken;
                if(persistenceType != PERSIST_CONNECTION)
                        client.register(this, false);


Reply via email to