fix: asset export path

This commit is contained in:
Jannat Patel
2026-04-03 13:18:11 +05:30
parent 7c1869853f
commit 7fe8d6c500
2 changed files with 6 additions and 5 deletions
@@ -59,7 +59,7 @@
class="h-[120px] flex items-center justify-center bg-surface-gray-1 border border-dashed border-outline-gray-3 rounded-md"
>
<div
class="w-fit bg-surface-white border rounded-md p-2 flex items-center justify-between items-center"
class="w-fit bg-surface-white border rounded-md p-2 flex items-center justify-between items-center space-x-4"
>
<div class="space-y-2">
<div class="font-medium leading-5 text-ink-gray-9">
+5 -4
View File
@@ -244,15 +244,16 @@ def write_assessments_json(zip_file, assessments, questions, test_cases):
for assessment in assessments:
assessment_json = frappe_json_dumps(assessment)
safe_doctype = assessment["doctype"].lower()
safe_name = sanitize_string(assessment["name"])
zip_file.writestr(f"assessments/{safe_doctype}_{safe_name}.json", assessment_json)
doctype = "_".join(assessment["doctype"].lower().split(" "))
safe_name = "_".join(sanitize_string(assessment["name"]).split(" "))
zip_file.writestr(f"assessments/{doctype}_{safe_name}.json", assessment_json)
def write_assets(zip_file, assets):
assets = list(set(assets))
for asset in assets:
if not asset or not isinstance(asset, str) or not is_safe_path(asset):
real_path = frappe.get_site_path(asset.lstrip("/"))
if not asset or not isinstance(asset, str) or not is_safe_path(real_path):
continue
file_doc = frappe.get_doc("File", {"file_url": asset})