fix: 课程资料schema支持PPT/PPTX文件类型
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -175,15 +175,15 @@ class CourseMaterialCreate(CourseMaterialBase):
|
|||||||
@field_validator("file_type")
|
@field_validator("file_type")
|
||||||
def validate_file_type(cls, v):
|
def validate_file_type(cls, v):
|
||||||
"""验证文件类型
|
"""验证文件类型
|
||||||
支持格式:TXT、Markdown、MDX、PDF、HTML、Excel、Word、CSV、VTT、Properties
|
支持格式:TXT、Markdown、MDX、PDF、HTML、Excel、Word、PPT、CSV、VTT、Properties
|
||||||
"""
|
"""
|
||||||
allowed_types = [
|
allowed_types = [
|
||||||
"txt", "md", "mdx", "pdf", "html", "htm",
|
"txt", "md", "mdx", "pdf", "html", "htm",
|
||||||
"xlsx", "xls", "docx", "doc", "csv", "vtt", "properties"
|
"xlsx", "xls", "docx", "doc", "pptx", "ppt", "csv", "vtt", "properties"
|
||||||
]
|
]
|
||||||
file_ext = v.lower()
|
file_ext = v.lower()
|
||||||
if file_ext not in allowed_types:
|
if file_ext not in allowed_types:
|
||||||
raise ValueError(f"不支持的文件类型: {v}。允许的类型: TXT、Markdown、MDX、PDF、HTML、Excel、Word、CSV、VTT、Properties")
|
raise ValueError(f"不支持的文件类型: {v}。允许的类型: TXT、Markdown、MDX、PDF、HTML、Excel、Word、PPT、CSV、VTT、Properties")
|
||||||
return file_ext
|
return file_ext
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user