This commit is contained in:
eta 2020-06-19 12:55:48 +01:00
parent 26620cf36b
commit 6c0e61f2a5

View file

@ -774,7 +774,7 @@ MEDIA-TYPE is one of (:image :video :audio :document)."
(multiple-value-bind (body status-code) (multiple-value-bind (body status-code)
(drakma:http-request put-url (drakma:http-request put-url
:additional-headers headers :additional-headers headers
:content-length (file-length file-data) :content-length (length decrypted-file)
:content-type mime-type :content-type mime-type
:method :put :method :put
:content decrypted-file) :content decrypted-file)
@ -794,6 +794,7 @@ MEDIA-TYPE is one of (:image :video :audio :document)."
(format *debug-io* "~&using path ~A~%" path) (format *debug-io* "~&using path ~A~%" path)
(cl-qrencode:encode-png-stream text stream) (cl-qrencode:encode-png-stream text stream)
(catcher (catcher
(let ((content-length (file-length stream)))
(attach (attach
(request-http-upload-slot comp (component-upload-component-name comp) (request-http-upload-slot comp (component-upload-component-name comp)
"qrcode.png" "qrcode.png"
@ -806,7 +807,7 @@ MEDIA-TYPE is one of (:image :video :audio :document)."
(drakma:http-request put-url (drakma:http-request put-url
:additional-headers headers :additional-headers headers
:content-type "image/png" :content-type "image/png"
:content-length (file-length stream) :content-length content-length
:method :put :method :put
:content path) :content path)
(unless (and (>= status-code 200) (< status-code 300)) (unless (and (>= status-code 200) (< status-code 300))
@ -822,7 +823,7 @@ MEDIA-TYPE is one of (:image :video :audio :document)."
(cxml:attribute "xmlns" +oob-ns+) (cxml:attribute "xmlns" +oob-ns+)
(cxml:with-element "url" (cxml:with-element "url"
(cxml:text get-url)))) (cxml:text get-url))))
(admin-msg comp jid "(Code expired? Be faster next time. Get a new one with `connect`.)"))))))) (admin-msg comp jid "(Code expired? Be faster next time. Get a new one with `connect`.)"))))))))
(t (e) (t (e)
(admin-msg comp jid (format nil "Failed to upload QR code!~%Report the following error to the bridge admin: `~A`" e))))))) (admin-msg comp jid (format nil "Failed to upload QR code!~%Report the following error to the bridge admin: `~A`" e)))))))