0

NOTE, this only happens on mac. Linux is fine.

For the given link, which is directly copied from chrome url bar,

https://lwn.net/Articles/262464/#Quick Quiz 5

org-open-at-point will open it as https://lwn.net/Articles/262464/%23Quick%20Quiz%205

where as the correct url should be: https://lwn.net/Articles/262464/#Quick%20Quiz%205

note that in the wrong one, # becomes %23.

0

Eventually, org-open-at-point invokes open(1) to visit the URL. It seems if the URL is invalid (e.g., contains spaces), open(1) will encode it before sending it to the web browser, for example, the command

~ $ open 'https://lwn.net/Articles/262464/#Quick Quiz 5'

opens https://lwn.net/Articles/262464/%23Quick%20Quiz%205 (404). However, if you the URL is valid, the open(1) works fine, the command

~ $ open 'https://lwn.net/Articles/262464/#Quick%20Quiz%205'

opens https://lwn.net/Articles/262464/#Quick%20Quiz%205 (200).

I think you can avoid the issue by entering URL in the valid encoded format. It's also possible to fix the encoding automatically via the following advice

(define-advice browse-url-default-macosx-browser
    (:filter-args (args) fix-url)
  "Fix URL encoding."
  (cl-callf url-encode-url (car args))
  args)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.