branch: externals/url-http-oauth commit 9d5c820c9025405637a455fc359b4a3fd03c5919 Author: Thomas Fitzsimmons <fitz...@fitzsim.org> Commit: Thomas Fitzsimmons <fitz...@fitzsim.org>
Fix auth-source lookups * url-http-oauth.el (url-http-oauth-port): Always return the port as a string. (url-http-oauth-get-bearer): Use empty string for null user. --- url-http-oauth.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/url-http-oauth.el b/url-http-oauth.el index 6d2f68c5d7..8ec20bc314 100644 --- a/url-http-oauth.el +++ b/url-http-oauth.el @@ -102,7 +102,10 @@ This function does the opposite of `url-http-oauth-interpose'." (defun url-http-oauth-port (url) "Return port of URL object. Assume an HTTPS URL that does not specify a port uses 443." - (or (url-port url) (when (string= "https" (url-type url)) 443))) + (let ((port-number (url-port url))) + (if port-number + (number-to-string port-number) + (when (string= "https" (url-type url)) "443")))) (defun url-http-oauth-get-access-token-grant (url code) "Get an access token for URL using CODE." @@ -202,7 +205,7 @@ URL is a parsed object." (car (let ((auth-source-do-cache nil)) (auth-source-search - :user (url-user url) + :user (or (url-user url) "") :host (url-host url) :port (url-http-oauth-port url) :path path @@ -222,7 +225,7 @@ URL is a parsed object." (bearer-retrieved (gethash "access_token" grant)) (auth-result (let ((auth-source-do-cache nil)) (auth-source-search - :user (url-user url) + :user (or (url-user url) "") :host (url-host url) :port (url-http-oauth-port url) :path path @@ -238,7 +241,7 @@ URL is a parsed object." :create '(path scope expiry) :max 1))) (save-function (plist-get (car auth-result) :save-function))) - ;; Success; save bearer. + ;; Success; save bearer. (when (functionp save-function) (funcall save-function)) bearer-retrieved))))