Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 捕获解码异常并修复在网页无法打开物品管理主页的问题 #397

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/
### Fixed

- 修复搜索位置无法显示的问题
- 捕获解码异常并修复在网页无法打开物品管理主页的问题

## [0.9.7] - 2024-02-05

Expand Down
4 changes: 2 additions & 2 deletions lib/storage/view/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class StorageHomeScreen extends StatelessWidget {
return MyHomePage(
activeTab: AppTab.storage,
actions: <Widget>[
// 仅支持安卓和网页
if (Platform.isAndroid || kIsWeb) const ScanQRIconButton(),
// 仅支持网页和安卓
if (kIsWeb || Platform.isAndroid) const ScanQRIconButton(),
const SearchIconButton(),
],
floatingActionButton: FloatingActionButton(
Expand Down
8 changes: 6 additions & 2 deletions lib/storage/view/widgets/scan_qr_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ class _ScanQRPageState extends State<ScanQRPage> {

bool validateStorageId(String id) {
Codec<String, String> stringToBase64 = utf8.fuse(base64);
final decoded = stringToBase64.decode(id);
return decoded.startsWith('Storage:');
try {
final decoded = stringToBase64.decode(id);
return decoded.startsWith('Storage:');
} catch (e) {
return false;
}
}
}
Loading