Skip to content

Commit

Permalink
Bugfix: replace characters AND links
Browse files Browse the repository at this point in the history
So when I added the `replace_links` function, I created a bug in the `nofo_import` route.

1a891b4

Here's the bug:

```python
cleaned_content = replace_chars(file_content)
cleaned_content = replace_links(file_content) # bug is here: this function should be taking "cleaned_content"
```

So the `replace_chars` function was being run but not saved, which meant that we were seeing weird stuff coming back in, primarily where we see this is around the application checkboxes.

Small fix to get this working again, although it took a while to find.
  • Loading branch information
pcraig3 authored and admoorgit committed Dec 12, 2024
1 parent 03079b5 commit ba727a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve

### Fixed

- bug: since adding replace_links, replace_chars was not being applied

## [1.39.0] - 2023-12-04

### Added
Expand Down
3 changes: 1 addition & 2 deletions bloom_nofos/nofos/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ def nofo_import(request, pk=None):
return redirect(view_path, **kwargs)

# replace problematic characters/links on import
cleaned_content = replace_chars(file_content)
cleaned_content = replace_links(file_content)
cleaned_content = replace_links(replace_chars(file_content))

soup = BeautifulSoup(cleaned_content, "html.parser") # Parse the cleaned HTML
soup = add_body_if_no_body(soup)
Expand Down

0 comments on commit ba727a8

Please sign in to comment.