Permalink
Browse files

fix argument handling for im.save()

  • Loading branch information...
1 parent 0cea6c7 commit b4ff9381cbca662ee076bef86c34ec9f80f56b7b Dane Springmeyer committed Nov 8, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/mapnik_image.cpp
View
@@ -510,8 +510,11 @@ Handle<Value> Image::save(const Arguments& args)
if (!args[1]->IsString())
return ThrowException(Exception::TypeError(
String::New("both 'filename' and 'format' arguments must be strings")));
-
- format = mapnik::guess_type(TOSTR(args[1]));
+ format = TOSTR(args[1]);
+ }
+ else
+ {
+ format = mapnik::guess_type(filename);
if (format == "<unknown>") {
std::ostringstream s("");
s << "unknown output extension for: " << filename << "\n";

0 comments on commit b4ff938

Please sign in to comment.