From 5bf025d5cad703afaff389ecf5437bf8c9ba71f7 Mon Sep 17 00:00:00 2001 From: Georg Sieber Date: Wed, 21 Jun 2023 18:26:00 +0200 Subject: [PATCH] avoid Array.toString() error messages --- notes@schorschii/files/notes@schorschii/desklet.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/notes@schorschii/files/notes@schorschii/desklet.js b/notes@schorschii/files/notes@schorschii/desklet.js index 4a51a7cc6..8289d5d46 100644 --- a/notes@schorschii/files/notes@schorschii/desklet.js +++ b/notes@schorschii/files/notes@schorschii/desklet.js @@ -13,6 +13,7 @@ const Cogl = imports.gi.Cogl; const Gio = imports.gi.Gio; const PopupMenu = imports.ui.popupMenu; const Gettext = imports.gettext; +const ByteArray = imports.byteArray; const UUID = "notes@schorschii"; const DESKLET_ROOT = imports.ui.deskletManager.deskletMeta[UUID].path; @@ -96,7 +97,7 @@ MyDesklet.prototype = { try { let [success, contents, tag] = file.load_contents_finish(response); if(success) { - let lines = contents.toString().split('\n'); + let lines = ByteArray.toString(contents).split('\n'); for(var i = 0;i < lines.length;i++) { let fields = lines[i].split(','); if(fields.length != 9) { continue; } @@ -137,7 +138,7 @@ MyDesklet.prototype = { try { let [success, contents, tag] = file.load_contents_finish(response); if(success) { - this.notecontent = contents.toString(); + this.notecontent = ByteArray.toString(contents); } else { // error reading file - maybe the file does not exist this.notecontent = _("Can't read text file.\nSelect a file in settings.\n\nClick here to edit.");