changeset 483:02d043b1967d

Accept file upload instead of binary gzip parameter
author nanaya <me@nanaya.pro>
date Sun, 28 Nov 2021 19:54:08 +0900
parents 403f71d22b7b
children 84ca55a0568e
files README.md app/models/paste.rb
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Sun Nov 28 19:45:59 2021 +0900
+++ b/README.md	Sun Nov 28 19:54:08 2021 +0900
@@ -30,11 +30,11 @@
 
 Or with gzip to save bandwidth:
 
-    ...some commands... | gzip | curl 'https://0paste.com/pastes.txt' -F 'paste[paste_gzip]=<-'
+    ...some commands... | gzip | curl 'https://0paste.com/pastes.txt' -F 'paste[paste_gzip]=@-'
 
 Privately:
 
-    ...some commands... | gzip | curl 'https://0paste.com/pastes.txt' -F 'paste[is_private]=1' -F 'paste[paste_gzip]=<-'
+    ...some commands... | gzip | curl 'https://0paste.com/pastes.txt' -F 'paste[is_private]=1' -F 'paste[paste_gzip]=@-'
 
 Design
 ------
--- a/app/models/paste.rb	Sun Nov 28 19:45:59 2021 +0900
+++ b/app/models/paste.rb	Sun Nov 28 19:54:08 2021 +0900
@@ -36,7 +36,7 @@
   end
 
   def paste_gzip=(paste)
-    self.paste = ActiveSupport::Gzip.decompress paste
+    self.paste = ActiveSupport::Gzip.decompress paste.read
   end
 
   def paste_gzip_base64=(paste)