whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] 02/02: appease Chrome by converting the spreadsheet a byte at a time
Date Thu, 16 Aug 2018 02:38:16 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git

commit 46058b1e8baff80c75ea72f5b79f2f23af2e87a5
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Wed Aug 15 22:37:52 2018 -0400

    appease Chrome by converting the spreadsheet a byte at a time
---
 www/board/agenda/views/buttons/post.js.rb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/www/board/agenda/views/buttons/post.js.rb b/www/board/agenda/views/buttons/post.js.rb
index b0ccfce..4a6f5b9 100644
--- a/www/board/agenda/views/buttons/post.js.rb
+++ b/www/board/agenda/views/buttons/post.js.rb
@@ -551,9 +551,13 @@ class Post < Vue
 
     reader = FileReader.new
     def reader.onload(event)
-      result = event.target.result
-      base64 = btoa(String.fromCharCode(*Uint8Array.new(result)))
-      post 'financials', spreadsheet: base64 do |response|
+      bytes = Uint8Array.new(event.target.result)
+      binary = ''
+      for i in 0...bytes.byteLength
+        binary += String.fromCharCode(bytes[i])
+      end
+
+      post 'financials', spreadsheet: btoa(binary) do |response|
         report = @report
         report += "\n" if report and not report.end_with? "\n"
         report += "\n" if report


Mime
View raw message