Skip to content

Commit 5d55b4f

Browse files
committed
dont try to upload to cdn if we dont have a bunnycdn login
1 parent 4dce68f commit 5d55b4f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mystbin/backend/routers/pastes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
__config = json.load(__f)
6363

6464
del __p, __f # micro-opt, don't keep unneeded variables in-ram
65+
HAS_BUNNYCDN = bool(__config["bunnycdn"]["token"])
6566

6667

6768
def generate_paste_id(n: int = 3):
@@ -224,7 +225,7 @@ async def post_rich_paste(
224225

225226
paste_id = generate_paste_id()
226227

227-
if images:
228+
if images and HAS_BUNNYCDN:
228229
async def _partial(target, spool: UploadFile):
229230
data = await spool.read()
230231
await request.app.state.client.put(target, data=data, headers=headers) # TODO figure out how to pass spooled object instead of load into memory

0 commit comments

Comments
 (0)