Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
Change: Don't advise url-http-create-request
Browse files Browse the repository at this point in the history
Use cl-letf to override it where needed.
  • Loading branch information
alphapapa committed Oct 10, 2018
1 parent d7591f9 commit 96dc95c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 7 additions & 6 deletions matrix-api-r0.3.0.el
Original file line number Diff line number Diff line change
Expand Up @@ -973,12 +973,13 @@ TYPING should be t or nil."
(insert-file-contents path)
(buffer-string)))
(endpoint (url-encode-url (format$ "https://$server/_matrix/media/r0/upload?filename=$filename"))))
(matrix-post session endpoint
:success (apply-partially #'matrix-upload-callback room
:cbargs (list :filename filename
:mime-type mime-type))
:content-type mime-type
:raw-data file-contents)))
(cl-letf (((symbol-function 'url-http-create-request) (symbol-function 'matrix--url-http-create-request)))
(matrix-post session endpoint
:success (apply-partially #'matrix-upload-callback room
:cbargs (list :filename filename
:mime-type mime-type))
:content-type mime-type
:raw-data file-contents))))

(matrix-defcallback upload matrix-room
"Callback for `matrix-upload'.
Expand Down
2 changes: 0 additions & 2 deletions matrix-helpers.el
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,5 @@ modified to allows binary uploads, which are prevented by the
(url-http-debug "Request is: \n%s" request)
request))

(advice-add #'url-http-create-request :override #'matrix--url-http-create-request)

(provide 'matrix-helpers)
;;; matrix-helpers.el ends here

0 comments on commit 96dc95c

Please sign in to comment.