Skip to content

Commit

Permalink
support: longer descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
henilp105 committed Apr 1, 2024
1 parent 930ab40 commit f528592
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions backend/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ def process_package(packagename: str) -> Tuple[bool, Union[dict, None], str]:
cleanup_command = f'rm -rf static/temp/{packagename} static/temp/{packagename}.tar.gz'
# run_command(cleanup_command)
print(result)

if parsed_toml['description'] == "README.md":
with open(f'static/temp/{packagename}/README.md', 'r') as file:
parsed_toml['description'] = html.escape(file.read()) # Sanitize HTML content

if 'description' in parsed_toml and parsed_toml['description'] == "README.md":
try:
with open(f'static/temp/{packagename}/README.md', 'r') as file:
parsed_toml['description'] = html.escape(file.read()) # Sanitize HTML content
except:
parsed_toml['description'] = "README.md not found."

if result[0]==-1:
# Package verification failed
Expand Down

0 comments on commit f528592

Please sign in to comment.