Skip to content

Commit

Permalink
fix(js): use replacement character on invalid decode (#25)
Browse files Browse the repository at this point in the history
When decoding incorrectly encoded content, the binding now panics and
takes down the entire JS script. This change replaces the incorrect
sequence with the U+FFFD replacement character (�) in the content. This
is most often the desired behaviour.
  • Loading branch information
barjin authored Jan 23, 2025
1 parent ea11f25 commit 5eec7e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/cli-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@ jobs:
# toolchain: ${{ matrix.toolchain }}
# args: "--locked --release"
# if: ${{ !matrix.platform.skip_tests }}
- name: Publish artifacts and release
uses: houseabsolute/actions-rust-release@v0.0.4
if: matrix.toolchain == 'stable'
with:
executable-name: impit-cli
target: ${{ matrix.platform.target }}
changes-file: ""

# - name: Publish artifacts and release
# uses: houseabsolute/actions-rust-release@v0.0.4
# if: matrix.toolchain == 'stable'
# with:
# executable-name: impit-cli
# target: ${{ matrix.platform.target }}
# changes-file: ""
2 changes: 1 addition & 1 deletion impit/src/response_parsing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub fn decode(bytes: &[u8], encoding_prior_knowledge: Option<encoding::EncodingR
}

encoding
.decode(bytes, encoding::DecoderTrap::Strict)
.decode(bytes, encoding::DecoderTrap::Replace)
.unwrap()
}

Expand Down

0 comments on commit 5eec7e7

Please sign in to comment.