Skip to content

Commit

Permalink
More URL work. Again.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jan 10, 2012
1 parent b2b71a9 commit 3eae151
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions feed/index.php
Expand Up @@ -52,12 +52,18 @@ function process_item($item, $url)
$appendimg = false;

// Ignore URL arguments (so we know that Amazon AWS is a simple image URL).
$debugext = false;
$ext = $url;
if ($debugext) print("ext start: '$ext'\n");
$ext = preg_replace('/\?.*/', '', $ext, 1);
if ($debugext) print("ext minus args: '$ext'\n");
$ext = preg_replace('/^.*\//', '', $ext, 1); // drop all paths
$ext = preg_replace('/^.*(\..*|)$/', '$1', $ext, 1); // extract file extension, if any.
if ($debugext) print("ext minus paths: '$ext'\n");
$ext = preg_replace('/^.*(\..*)$/', '$1', $ext, 1); // extract file extension, if any.
if ($ext[0] != '.') $ext = '';
if ($debugext) print("ext minus everything: '$ext'\n");

#print("<pre>url is '$url', ext is '$ext'</pre>\n");
if ($debugext) print("url is '$url', ext is '$ext'\n");

if (($ext == NULL) || (strlen($ext) == 0)) // no filename extension on this URL?
{
Expand Down

0 comments on commit 3eae151

Please sign in to comment.