Merge pull request #1171 from pateljannat/scorm-check-if-file
fix: check if its file before fetching
This commit is contained in:
@@ -154,9 +154,11 @@ class SCORMRenderer(BaseRenderer):
|
|||||||
if not extension:
|
if not extension:
|
||||||
path = f"{path}.html"
|
path = f"{path}.html"
|
||||||
|
|
||||||
f = open(path, "rb")
|
# check if path exists and is actually a file and not a folder
|
||||||
response = Response(
|
if os.path.exists(path) and os.path.isfile(path):
|
||||||
wrap_file(frappe.local.request.environ, f), direct_passthrough=True
|
f = open(path, "rb")
|
||||||
)
|
response = Response(
|
||||||
response.mimetype = mimetypes.guess_type(path)[0]
|
wrap_file(frappe.local.request.environ, f), direct_passthrough=True
|
||||||
return response
|
)
|
||||||
|
response.mimetype = mimetypes.guess_type(path)[0]
|
||||||
|
return response
|
||||||
|
|||||||
Reference in New Issue
Block a user