From fa434c4bdda78df8120d78ebd31512c5ba895a7e Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Tue, 21 Apr 2020 15:40:06 -0400 Subject: [PATCH] Fix file downloads in Windows (#1336) * Fixes an issue where files could not be downloaded when running on Windows * Closes #1334 --- CTFd/utils/uploads/uploaders.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CTFd/utils/uploads/uploaders.py b/CTFd/utils/uploads/uploaders.py index 8485840e..9220c744 100644 --- a/CTFd/utils/uploads/uploaders.py +++ b/CTFd/utils/uploads/uploaders.py @@ -1,4 +1,5 @@ import os +import posixpath import string from shutil import copyfileobj @@ -54,7 +55,7 @@ class FilesystemUploader(BaseUploader): filename = secure_filename(filename) md5hash = hexencode(os.urandom(16)) - file_path = os.path.join(md5hash, filename) + file_path = posixpath.join(md5hash, filename) return self.store(file_obj, file_path)