Author: dbkr
Date: 2006-03-25 19:05:35 +0000 (Sat, 25 Mar 2006)
New Revision: 8317

Modified:
   trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
   trunk/freenet/src/freenet/node/Version.java
Log:
574: Better fix for allowing bookmark-adding links through the content filter.


Modified: 
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java
===================================================================
--- 
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java    
    2006-03-25 18:29:21 UTC (rev 8316)
+++ 
trunk/freenet/src/freenet/clients/http/filter/GenericReadFilterCallback.java    
    2006-03-25 19:05:35 UTC (rev 8317)
@@ -37,17 +37,17 @@
                        return null;
                }
                // mailto: not supported yet - FIXME what to do with it? what 
queries are allowed? can it possibly hurt us? how to construct safely? etc
-               if (path.startsWith("/") && path.substring(1).indexOf("/") == 
-1) {
+               
+               HTTPRequest req = new HTTPRequest(uri);
+               if (path.equals("/") && req.isParameterSet("newbookmark")) {
                        // allow links to the root to add bookmarks
-                       HTTPRequest req = new HTTPRequest(uri);
-                       
                        String bookmark_key = req.getParam("newbookmark");
                        String bookmark_desc = req.getParam("desc");

                        bookmark_key = HTMLEncoder.encode(bookmark_key);
                        bookmark_desc = HTMLEncoder.encode(bookmark_desc);

-                       return 
path+"?newbookmark="+bookmark_key+"&desc="+bookmark_desc;
+                       return 
"/?newbookmark="+bookmark_key+"&desc="+bookmark_desc;
                } else if(path.startsWith("/")) {
                        // Try to make it into a FreenetURI
                        try {
@@ -62,7 +62,6 @@
                        // FIXME resolve it
                        // FIXME Note that we allow links to / inlines from 
fproxy services.
                        // This is okay because we don't allow forms.
-                       HTTPRequest req = new HTTPRequest(uri);
                        return finishProcess(req, overrideType, path);
                }
                Logger.normal(this, "Unrecognized URI, dropped: "+uri);

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-03-25 18:29:21 UTC (rev 
8316)
+++ trunk/freenet/src/freenet/node/Version.java 2006-03-25 19:05:35 UTC (rev 
8317)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 573;
+       private static final int buildNumber = 574;

        /** Oldest build of Fred we will talk to */
        private static final int lastGoodBuild = 507;


Reply via email to