Permalink
Browse files

get_paths return 404 when the image doesn't exist

I thought I had commited that but it stayed in my stash...
  • Loading branch information...
1 parent 7f342f8 commit 2ba5a5c041dba2426060e53e3340a4ad751ad565 @yannk committed Jul 3, 2012
Showing with 6 additions and 2 deletions.
  1. +4 −1 Changes
  2. +2 −1 lib/MogileFS/REST.pm
View
@@ -1,3 +1,6 @@
-0.2 Wed Jun 27 10:00:00 2012
+0.02 Wed Jun 27 10:00:00 2012
- Add ?paths=1 to get the paths, rather than relying on Perlbal headers
- Remove Content-Length from HEAD requests
+
+0.03 Tue Jul 3 12:00:00 2012
+ - Fix 200 response with empty body for ?paths when file doesn't exist.
@@ -8,7 +8,7 @@ use Plack::Request;
use Plack::Response;
use Data::Dumper;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
## set shortcut methods to log handler
for my $lvl (qw/debug info warn error fatal/) {
@@ -145,6 +145,7 @@ sub get_paths {
$res->content_type('text/plain');
my $client = $app->get_client($domain);
my @paths = $client->get_paths($key, { no_verify => 1 });
+ return $app->respond_not_found($req) unless @paths;
my $paths = join "\n", @paths;
$res->header('Content-Length', length $paths);
if ($req->method ne 'HEAD') {

0 comments on commit 2ba5a5c

Please sign in to comment.