Author: toad
Date: 2007-06-16 20:50:20 +0000 (Sat, 16 Jun 2007)
New Revision: 13629

Modified:
   trunk/freenet/src/freenet/client/ClientMetadata.java
   trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
Log:
Fix it

Modified: trunk/freenet/src/freenet/client/ClientMetadata.java
===================================================================
--- trunk/freenet/src/freenet/client/ClientMetadata.java        2007-06-16 
20:36:14 UTC (rev 13628)
+++ trunk/freenet/src/freenet/client/ClientMetadata.java        2007-06-16 
20:50:20 UTC (rev 13629)
@@ -58,8 +58,8 @@
        }

        public String getMIMETypeNoParams() {
-               if(mimeType == null) return null;
                String s = mimeType;
+               if(s == null) return null;
                int i = s.indexOf(';');
                if(i > -1) {
                        s = s.substring(i);

Modified: trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-06-16 20:36:14 UTC (rev 13628)
+++ trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2007-06-16 20:50:20 UTC (rev 13629)
@@ -310,6 +310,7 @@
                                if(clientMetadata.getMIMETypeNoParams() != null 
&& ctx.allowedMIMETypes != null &&
                                                
!ctx.allowedMIMETypes.contains(clientMetadata.getMIMETypeNoParams())) {
                                        onFailure(new 
FetchException(FetchException.WRONG_MIME_TYPE));
+                                       return;
                                }
                                // Fetch it from the archive
                                if(ah == null)
@@ -378,7 +379,7 @@
                                if(logMINOR) Logger.minor(this, "Is single-file 
redirect");
                                
clientMetadata.mergeNoOverwrite(metadata.getClientMetadata()); // even 
splitfiles can have mime types!

-                               String mimeType = clientMetadata.getMIMEType();
+                               String mimeType = 
clientMetadata.getMIMETypeNoParams();
                                if(mimeType != null && 
ArchiveManager.isUsableArchiveType(mimeType) && metaStrings.size() > 0) {
                                        // Looks like an implicit archive, 
handle as such
                                        metadata.setArchiveManifest();
@@ -386,8 +387,9 @@
                                }

                                if(mimeType != null && ctx.allowedMIMETypes != 
null && 
-                                               
!ctx.allowedMIMETypes.contains(clientMetadata.getMIMETypeNoParams())) {
+                                               
!ctx.allowedMIMETypes.contains(mimeType)) {
                                        onFailure(new 
FetchException(FetchException.WRONG_MIME_TYPE));
+                                       return;
                                }

                                // Simple redirect
@@ -435,7 +437,7 @@

                                
clientMetadata.mergeNoOverwrite(metadata.getClientMetadata()); // even 
splitfiles can have mime types!

-                               String mimeType = clientMetadata.getMIMEType();
+                               String mimeType = 
clientMetadata.getMIMETypeNoParams();
                                if(mimeType != null && 
ArchiveManager.isUsableArchiveType(mimeType) && metaStrings.size() > 0) {
                                        // Looks like an implicit archive, 
handle as such
                                        metadata.setArchiveManifest();
@@ -443,8 +445,9 @@
                                }

                                if(mimeType != null && ctx.allowedMIMETypes != 
null &&
-                                               
!ctx.allowedMIMETypes.contains(clientMetadata.getMIMETypeNoParams())) {
+                                               
!ctx.allowedMIMETypes.contains(mimeType)) {
                                        onFailure(new 
FetchException(FetchException.WRONG_MIME_TYPE));
+                                       return;
                                }

                                // Splitfile (possibly compressed)


Reply via email to