Skip to content

Commit

Permalink
fix: fix missing Post.file.name may cause download file named to `N…
Browse files Browse the repository at this point in the history
…one`
  • Loading branch information
Ljzd-PRO committed May 5, 2024
1 parent 7177fa7 commit 7e45d2b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ktoolbox/action/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,22 @@ async def create_job_from_post(
)

# Filter and create jobs for ``Post.file``
post_file_name = post.file.name or Path(post.file.path).name
if post.file and post.file.path and any(
map(
lambda x: fnmatch(post.file.name or Path(post.file.path).name, x),
lambda x: fnmatch(post_file_name, x),
config.job.allow_list
)
) and not any(
map(
lambda x: fnmatch(post.file.name or Path(post.file.path).name, x),
lambda x: fnmatch(post_file_name, x),
config.job.block_list
)
):
jobs.append(
Job(
path=post_path,
alt_filename=f"{post.id}_{post.file.name}",
alt_filename=f"{post.id}_{post_file_name}",
server_path=post.file.path,
type=PostFileTypeEnum.File
)
Expand Down

0 comments on commit 7e45d2b

Please sign in to comment.