Skip to content

Commit

Permalink
fix: reserve classroom status #4 for compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
UNIDY2002 committed Mar 3, 2023
1 parent 09c6b20 commit dbaba7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/thu-info-lib/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
breaking: modify return structure of `getClassroomState`
fix(ios, uFetch): parse base64 results (e.g. jpeg results) correctly
7 changes: 6 additions & 1 deletion packages/thu-info-lib/src/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ export const uFetch = async (
if (typeof reader.result === "string") {
if (base64) {
// Simply return the string data with the MIME header removed
resolve(reader.result.substr("data:application/octet-stream;base64,".length));
const r = /data:.+?;base64,(.+)/g.exec(reader.result);
if (r !== null && r[1] !== undefined) {
resolve(r[1]);
} else {
reject(new Error("Failed to parse MIME result in uFetch."));
}
} else {
// The value stored in `reader.result` has already been parsed with the correct encoding
resolve(reader.result);
Expand Down

0 comments on commit dbaba7d

Please sign in to comment.