From 4286b3577505efb2590660a3103c232fef1fbc62 Mon Sep 17 00:00:00 2001 From: jomo Date: Sat, 25 Apr 2015 22:59:33 +0200 Subject: [PATCH] support redirection for capes --- lib/routes/capes.js | 2 ++ test/test.js | 8 -------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/routes/capes.js b/lib/routes/capes.js index 415e272..b43ae9a 100644 --- a/lib/routes/capes.js +++ b/lib/routes/capes.js @@ -5,6 +5,7 @@ var cache = require("../cache"); // GET cape request module.exports = function(req, callback) { var userId = (req.url.pathname.split("/")[2] || "").split(".")[0]; + var def = req.url.query.default; var rid = req.id; if (!helpers.id_valid(userId)) { @@ -31,6 +32,7 @@ module.exports = function(req, callback) { status: status, body: image, type: image ? "image/png" : undefined, + redirect: image ? undefined : def, hash: hash, err: err }); diff --git a/test/test.js b/test/test.js index c61251e..9619261 100644 --- a/test/test.js +++ b/test/test.js @@ -381,10 +381,6 @@ describe("Crafatar", function() { url: "http://localhost:3000/capes/0", crc32: 0 }, - "cape with not existing username defaulting to alex": { - url: "http://localhost:3000/capes/0?default=alex", - crc32: 0 - }, "cape with not existing username defaulting to url": { url: "http://localhost:3000/capes/0?default=http://example.com", crc32: 0, @@ -399,10 +395,6 @@ describe("Crafatar", function() { url: "http://localhost:3000/capes/00000000000000000000000000000000", crc32: 0 }, - "cape with not existing uuid defaulting to alex": { - url: "http://localhost:3000/capes/00000000000000000000000000000000?default=alex", - crc32: 0 - }, "cape with not existing uuid defaulting to url": { url: "http://localhost:3000/capes/00000000000000000000000000000000?default=http://example.com", crc32: 0,