Skip to content

Commit

Permalink
fix: error caused by slash in name and OPENSSL_CONF (#171)
Browse files Browse the repository at this point in the history
* fix: error caused by slash in name and OPENSSL_CONF

* ci(pre-commit): auto fixes from pre-commit hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
yingqi-z20 and pre-commit-ci[bot] authored Jul 5, 2024
1 parent 5b1a1c3 commit d89efaf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions scripts/download-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ set -o pipefail

export OPENSSL_CONF="openssl.cnf"
args=(tld)
for year in {2020..2023}; do
for year in {2020..2024}; do
for term in {1..3}; do
semester="${year}-$((year + 1))-${term}"
args+=(--semester="${semester}")
done
done
"${args[@]}"
OPENSSL_CONF="openssl.cnf" "${args[@]}"
10 changes: 6 additions & 4 deletions thu_learn_downloader/download/filename.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def document(
/ course.name
/ "docs"
/ document_class.title
/ f"{index:02d}-{document.title}"
/ f"{index:02d}-{document.title}".replace("/", "-slash-")
)
if document.file_type:
filename = filename.with_suffix("." + document.file_type)
Expand All @@ -35,7 +35,7 @@ def homework(
/ semester.id
/ course.name
/ "work"
/ f"{homework.number:02d}-{homework.title}"
/ f"{homework.number:02d}-{homework.title}".replace("/", "-slash-")
/ "README.md"
)

Expand All @@ -49,13 +49,15 @@ def attachment(
) -> Path:
filename: Path = Path(attachment.name)
filename = filename.with_stem(
f"{homework.number:02d}-{homework.title}-{attachment.type_}"
f"{homework.number:02d}-{homework.title}-{attachment.type_}".replace(
"/", "-slash-"
)
)
return (
prefix
/ semester.id
/ course.name
/ "work"
/ f"{homework.number:02d}-{homework.title}"
/ f"{homework.number:02d}-{homework.title}".replace("/", "-slash-")
/ filename
)

0 comments on commit d89efaf

Please sign in to comment.