(whimsy) branch master updated: Don't delete attachments on completion

2024-05-03 Thread sebb
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 36e353c0 Don't delete attachments on completion
36e353c0 is described below

commit 36e353c0ceac282f988ab1504eac4b8992acd6b2
Author: Sebb 
AuthorDate: Sat May 4 00:34:01 2024 +0100

Don't delete attachments on completion

Makes it easier to reprocess if necessary
---
 www/secretary/workbench/views/parts.js.rb | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/www/secretary/workbench/views/parts.js.rb 
b/www/secretary/workbench/views/parts.js.rb
index a5a2558c..84717462 100644
--- a/www/secretary/workbench/views/parts.js.rb
+++ b/www/secretary/workbench/views/parts.js.rb
@@ -543,6 +543,18 @@ class Parts < Vue
 }
   end
 
+  # delete a message (keeping attachments)
+  def delete_message(event)
+@busy = true
+pathname = window.parent.location.pathname
+HTTP.delete(pathname).then {
+  window.parent.location.href = '../..'
+}.catch {|error|
+  alert error
+  @busy = false
+}
+  end
+
   # delete an attachment
   def delete_attachment(event)
 data = {
@@ -736,7 +748,7 @@ class Parts < Vue
   # tasklist completion events
   def status_update(event)
 if event.data.status == 'complete'
-  self.delete_attachment(event)
+  self.delete_message(event)
 elsif event.data.status == 'keep'
   @selected = nil
   @form = :categorize



(whimsy) branch master updated: Bug - incorrectly converted

2024-05-03 Thread sebb
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 8b324e62 Bug - incorrectly converted
8b324e62 is described below

commit 8b324e62397cbe4f4550c571cbbc998f50e58ac4
Author: Sebb 
AuthorDate: Fri May 3 15:00:42 2024 +0100

Bug - incorrectly converted
---
 lib/whimsy/asf/string-utils.rb | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/whimsy/asf/string-utils.rb b/lib/whimsy/asf/string-utils.rb
index b660273d..6e7a0e60 100644
--- a/lib/whimsy/asf/string-utils.rb
+++ b/lib/whimsy/asf/string-utils.rb
@@ -58,13 +58,12 @@ module ASFString
 
   # fix encoding errors
   def self.fix_encoding(text)
-result = text
-
-if encoding == Encoding::BINARY
-  result = encode('utf-8', invalid: :replace, undef: :replace)
+  
+if text.encoding == Encoding::BINARY
+  return text.encode('utf-8', invalid: :replace, undef: :replace)
 end
+return text
 
-result
   end
 end
 
@@ -79,4 +78,7 @@ if __FILE__ == $0
   # puts txt
   puts ASFString.word_wrap(txt)
   puts ASFString.reflow(txt)
+  text="\x05\x00\x68\x65\x6c\x6c\x6f"
+  text.force_encoding(Encoding::BINARY)
+  puts ASFString.fix_encoding(text)
 end