Skip to content

Commit

Permalink
Fix correct decode err when no further action
Browse files Browse the repository at this point in the history
  • Loading branch information
rk0cc committed Dec 15, 2023
1 parent b1ebeb7 commit 9d25b5d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions model/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.2

* Fix decode error if original String displayed normal already.

## 2.1.1

* Revert redirection disable as default
Expand Down
10 changes: 9 additions & 1 deletion model/lib/src/parser/property_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ abstract base mixin class MetaPropertyParser {
.map((e) {
final attr = e.attributes;

return (attr['property']!, utf8.decode(attr['content']!.runes.toList()));
String ctx = attr['content']!;

try {
ctx = utf8.decode(ctx.runes.toList());
} on FormatException {
// If not work, leave origin ctx.
}

return (attr['property']!, ctx);
});

resolveMetaTags(metaParser, UnmodifiableListView(metaTagsProp));
Expand Down
2 changes: 1 addition & 1 deletion model/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: oghref_model
description: Object standarized definition with parser interface for constructing rich information of given URL among various metadata protocols.
version: 2.1.1
version: 2.1.2
repository: https://github.com/rk0cc/oghref/tree/main/model
issue_tracker: https://github.com/rk0cc/oghref/issues
funding:
Expand Down

0 comments on commit 9d25b5d

Please sign in to comment.