bluewormlabs/wpcdnrewrite — pull request #4 by mcg1969 (2014-02-19 14:35:11+00:00)
Title: Eliminates "//" for href="/..." case; avoids rewriting when no rules match

The deletions at lines 327-329 handle an issue I was having where the plugin was producing double-slashed URLs. For instance, "/cvx/cvx-w32.zip" was replaced with "http://cvxr.com//cvx/cvx-w32.zip" instead of "http://cvxr.com/cvx/cvx-w32.zip"

I'm not sure why these lines were necessary: the surrounding 'if' statement establishes that `$url` has an opening slash, so `network_site_url() . $url` should do just fine. But even so, `starts_with( $base, '/' )` doesn't seem to make sense; that should *never* evaluate to true for any well-formed URL. Perhaps you meant to use `ends_with`? But again, I see no reason for it anyway, though I may be missing something.

A few lines later, I modified the code so that if no matching rule is found, the URL is left unchanged. In other words, "/cvx/cvx-w32.zip" should be *left as-is* (if the file type doesn't match, of course), instead of being replaced with "http://cvxr.com/cvx/cvx-w32.zip".