unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: jidanni@jidanni.org
Cc: 5362@debbugs.gnu.org
Subject: bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons
Date: Fri, 25 Dec 2015 23:15:08 +0100	[thread overview]
Message-ID: <8737uqxjir.fsf@gnus.org> (raw)
In-Reply-To: <87iqb8le7x.fsf@jidanni.org> (jidanni@jidanni.org's message of "Tue, 12 Jan 2010 01:54:10 +0800")

jidanni@jidanni.org writes:

> b runs the command browse-url-of-dired-file
> And when used on
> /tmp/WWW::Facebook::API.html
> it tried to browse
> ftp://tmp/WWW/:Facebook::API.html
>
> Say, aren't files always local files?

They are, so this is pretty nonsensical.

The culprit here is

(defun browse-url-file-url (file)
  "Return the URL corresponding to FILE.
Use variable `browse-url-filename-alist' to map filenames to URLs."
  (let ((coding (if (equal system-type 'windows-nt)
		    ;; W32 pretends that file names are UTF-8 encoded.
		    'utf-8
		  (and (default-value 'enable-multibyte-characters)
		       (or file-name-coding-system
			   default-file-name-coding-system)))))
    (if coding (setq file (encode-coding-string file coding))))
  (setq file (browse-url-url-encode-chars file "[*\"()',=;?% ]"))
  (dolist (map browse-url-filename-alist)
    (when (and map (string-match (car map) file))
      (setq file (replace-match (cdr map) t nil file))))
  file)

(browse-url-file-url "/tmp/WWW::Facebook::API.html")
=> "ftp://tmp/WWW/:Facebook::API.html"

Which is wrong.

I don't quite understand why it does all this?  Why doesn't it just
prepend "file://" to the file name?  (Ok, it should probably do the
browse-url-url-encode-chars thing, anyway...)

Ideas?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2015-12-25 22:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-11 17:54 bug#5362: 23.1.91; browse-url-of-dired-file vs. files::with::colons jidanni
2015-12-25 22:15 ` Lars Ingebrigtsen [this message]
2015-12-25 22:43   ` Andreas Schwab
2015-12-26  8:17   ` Eli Zaretskii
2015-12-26 12:41     ` Lars Ingebrigtsen
2015-12-26 13:26       ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737uqxjir.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=5362@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).