[polari] pasteManager: Fix loading text files



commit a14240092f3fab35ba9dbf5ea062f8f12497fb89
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Aug 24 22:13:08 2021 +0200

    pasteManager: Fix loading text files
    
    Gio._promisify() tries to be helpful and removes a boolean "success"
    return value from the results.
    
    While at it, replace the deprecated to_string() override with the
    new TextDecoder support.
    
    https://gitlab.gnome.org/GNOME/polari/-/merge_requests/217

 src/pasteManager.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/pasteManager.js b/src/pasteManager.js
index 4bc1422e..fb0f59e9 100644
--- a/src/pasteManager.js
+++ b/src/pasteManager.js
@@ -55,8 +55,8 @@ export default class PasteManager {
         let targetType = _getTargetForContentType(contentType);
 
         if (targetType === DndTargetType.TEXT) {
-            const [, contents] = await file.load_contents_async(null);
-            return Utils.gpaste(contents.toString(), title);
+            const [contents] = await file.load_contents_async(null);
+            return Utils.gpaste(new TextDecoder().decode(contents), title);
         } else if (targetType === DndTargetType.IMAGE) {
             const stream = await file.read_async(GLib.PRIORITY_DEFAULT, null);
             const pixbuf =


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]