From 18fd39b335faee6be30774b25104eb96f151fac9 Mon Sep 17 00:00:00 2001
From: MeiMei <30769358+mei23@users.noreply.github.com>
Date: Wed, 6 Feb 2019 00:20:00 +0900
Subject: [PATCH] =?UTF-8?q?proxy=E3=81=A7400=E7=95=AA=E5=8F=B0=E3=81=AF?=
 =?UTF-8?q?=E3=81=9D=E3=81=AE=E3=82=B9=E3=83=86=E3=83=BC=E3=82=BF=E3=82=B9?=
 =?UTF-8?q?=E3=82=92=E8=BF=94=E3=81=99=20(#4154)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/server/proxy/proxy-media.ts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/server/proxy/proxy-media.ts b/src/server/proxy/proxy-media.ts
index 0e8db5f82b..3f234a727d 100644
--- a/src/server/proxy/proxy-media.ts
+++ b/src/server/proxy/proxy-media.ts
@@ -42,7 +42,12 @@ export async function proxyMedia(ctx: Koa.BaseContext) {
 		ctx.body = image.data;
 	} catch (e) {
 		serverLogger.error(e);
-		ctx.status = 500;
+
+		if (typeof e == 'number' && e >= 400 && e < 500) {
+			ctx.status = e;
+		} else {
+			ctx.status = 500;
+		}
 	} finally {
 		cleanup();
 	}