Skip to content

Commit

Permalink
Merge pull request #65 from uclahs-cds/aholmes-fix-query-string-crash
Browse files Browse the repository at this point in the history
Fix problem with application crashing when query string is stored as bytes
  • Loading branch information
aholmes committed May 16, 2024
2 parents 99162e6 + bf7be15 commit 85ddfb0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

# `BL_Python.web` [0.2.1] - 2024-05-16
- [BL_Python.web v0.2.1](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.web-v0.2.1/src/web/CHANGELOG.md#021---2024-05-16)
# `BL_Python.web` [0.2.2] - 2024-05-16
- [BL_Python.web v0.2.2](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.web-v0.2.2/src/web/CHANGELOG.md#022---2024-05-16)

# `BL_Python.platform` [0.2.2] - 2024-05-16
- [BL_Python.platform v0.2.2](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.platform-v0.2.2/src/platform/CHANGELOG.md#021---2024-05-16)
- [BL_Python.platform v0.2.2](https://github.com/uclahs-cds/BL_Python/blob/BL_Python.platform-v0.2.2/src/platform/CHANGELOG.md#022---2024-05-16)

# `BL_Python.all` [0.2.3] - 2024-05-16
- Contains all libraries up to v0.2.1, and `BL_Python.platform` v0.2.2 and `BL_Python.web` v0.2.2

# [0.2.0] - 2024-05-14
### Added
Expand Down
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: str = "0.2.2"
__version__: str = "0.2.3"
2 changes: 1 addition & 1 deletion src/web/BL_Python/web/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: str = "0.2.1"
__version__: str = "0.2.2"
6 changes: 6 additions & 0 deletions src/web/BL_Python/web/middleware/openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,12 @@ async def __call__(
}),
)

# Some values, like the query string, are stored as bytes.
# Decode as a UTF-8 str so encoding later doesn't fail.
for key, value in request_environ.items():
if isinstance(value, bytes):
request_environ[key] = value.decode("utf-8")

request_ctx = exit_stack.enter_context(
app.request_context(request_environ)
)
Expand Down
3 changes: 2 additions & 1 deletion src/web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Review the `BL_Python` [CHANGELOG.md](https://github.com/uclahs-cds/BL_Python/bl

---

## [0.2.1] - 2024-05-16
## [0.2.2] - 2024-05-16
### Changed
- Ignore sentinel files created by `make`.

### Fixed
- Update type annotation for variable causing new failure in Pyright.
- Resolved crash when query string is stored as a byte array.

0 comments on commit 85ddfb0

Please sign in to comment.