commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad Neuberg <bradneub...@yahoo.com>
Subject Re: [feedparser] Attaching patch again
Date Mon, 06 Sep 2004 01:44:58 GMT
Hi Kevin.  Did you rerun the unit tests after that
change to make sure they work?

Brad

--- "Kevin A. Burton" <burton@newsmonster.org> wrote:

> Brad Neuberg wrote:
> 
> > It looks like attachments are stripped out of the
> mailing list; here 
> > is the patch in unified diff format:
> >
> I rewrote getFeedPath
> 
> 1.  it was using duplicate indexOf queries for the
> same value.  Wasted 
> CPU :-/  Also I used lastIndexOf to start scan from
> the end of the string.
> 
> 2.  It stripped text after # or ? but not both... so
> 
> http://foo.com?cat=dog#here
> 
> would not work...
> 
> Here is the new method body:
> 
> >    protected static String getFeedPath( String
> resource ) 
> >
> >        throws MalformedURLException {
> >
> >        
> >
> >        // strip off any query string or anchors
> >
> >        int end = resource.lastIndexOf( "#" );
> >
> >        
> >
> >        if ( end != -1 )
> >
> >            resource = resource.substring( 0, end
> );
> >
> >        end = resource.lastIndexOf( "?" );
> >
> >        if ( end != -1 )
> >
> >            resource = resource.substring( 0, end
> );
> >
> >        if ( ! resource.endsWith( "blosxom.cgi" ) )
> {
> >
> >            Matcher fileMatcher =
> patternToStrip.matcher(resource);
> >
> >            resource = fileMatcher.replaceAll("");
> >
> >        }
> >
> >        
> >
> >        if ( ! resource.endsWith( "/" ) ) {
> >
> >            resource = resource + "/";
> >
> >        }
> >
> >        
> >
> >        return resource;
> >
> >    }
> >
> 
> 
> Kevin
> 
> -- 
> 
> Please reply using PGP.
> 
>     http://peerfear.org/pubkey.asc    
>     
>     NewsMonster - http://www.newsmonster.org/
>     
> Kevin A. Burton, Location - San Francisco, CA, Cell
> - 415.595.9965
>        AIM/YIM - sfburtonator,  Web -
> http://peerfear.org/
> GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D
> 8D04 99F1 4412
>   IRC - freenode.net #infoanarchy | #p2p-hackers |
> #newsmonster
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message