Skip to content

Commit

Permalink
fix file handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tasgon committed Feb 22, 2024
1 parent edb1ed1 commit 2299318
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions frontend/src/lib/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
if (!file) return;
file.arrayBuffer().then((data) => {
try {
let string_data = String.fromCharCode.apply(null, new Uint8Array(data));
let profile: DataWithDiagnostics = JSON.parse(string_data);
data_map.set("local_file", profile);
let string_data = new TextDecoder().decode(data);
let profile: Profile = JSON.parse(string_data);
data_map.set("local_file", { data: profile });
window.location.href = "#local_file";
} catch (e) {
notify(`Couldn't open ${file.name}: ${e}`);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ export interface Diagnostics {

export interface DataWithDiagnostics {
data: Profile;
diagnostics: Diagnostics;
diagnostics?: Diagnostics;
}

0 comments on commit 2299318

Please sign in to comment.