From 2e78d1689a268c27144e2d5fe21d98d9b0d0a06f Mon Sep 17 00:00:00 2001 From: jjs Date: Sun, 29 Jul 2007 20:25:34 +0000 Subject: [PATCH] danbooru api: fix uploaded filename, other small stuff git-svn-id: file:///home/shish/svn/shimmie2/trunk@397 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/danbooru_api/main.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/danbooru_api/main.php b/contrib/danbooru_api/main.php index f11b4790..e99e6121 100644 --- a/contrib/danbooru_api/main.php +++ b/contrib/danbooru_api/main.php @@ -123,7 +123,7 @@ class DanbooruApi extends Extension if(isset($_FILES['file'])) { // A file was POST'd in $file = $_FILES['file']['tmp_name']; - $filename = $file['name']; + $filename = $_FILES['file']['name']; // If both a file is posted and a source provided, I'm assuming source is the source of the file $source = isset($_REQUEST['source']) ? $_REQUEST['source'] : ""; } elseif(isset($_REQUEST['source'])) @@ -207,7 +207,7 @@ class DanbooruApi extends Extension if(!is_null($existing)) { header("HTTP/1.0 409 Conflict"); header("X-Danbooru-Errors: duplicate"); - $existinglink = "http://" . $_SERVER['HTTP_HOST'] . make_link("post/view/" . $existing->id); + $existinglink = make_link("post/view/" . $existing->id); header("X-Danbooru-Location: $existinglink"); } @@ -216,6 +216,7 @@ class DanbooruApi extends Extension send_event($nevent); // Did something screw up? if($event->vetoed) { + header("HTTP/1.0 409 Conflict"); header("X-Danbooru-Errors: $event->veto_reason"); return; } else @@ -232,6 +233,7 @@ class DanbooruApi extends Extension } } else { + header("HTTP/1.0 409 Conflict"); header("X-Danbooru-Errors: authentication error"); return; }