← Back to team overview

zim-wiki team mailing list archive

Re: ms-outlook uri support

 

On Thu, Dec 1, 2011 at 7:46 PM, Greg Warner <gdwarner@xxxxxxxxx> wrote:

> Here is the code you are referring to (contained within a function called
> open_url()):
>
>     elif url.startswith('outlook:') and hasattr(os, 'startfile'):
>       # Special case for outlook folder paths on windows
>       os.startfile(url)
>
> First thing I notice is that it's looking for "outlook" and not "Outlook"
> (which is what the link generator program uses... no biggie).
>

That is fixed easily by making the check case insensitive. Probably should
match all URL schemes case insensitive now I think about it....


> The problem is that open_url() is only called if the link-type (as
> determined by the link_type() function in parsing.py) does not match either
> interwiki, page, file, or notebook (see pageview.py:4547).  Without the
> modifications I made, the link-type is determined to be a page as it does
> not match the url regex, and therefore, the open_url() function never gets
> called for an outlook link.
>
> Does that make sense?
>
> If the outlook links had the double slash after the colon (outlook://), we
> wouldn't be having this problem as it would match the url regex.  But it
> does not.
>

OK, now I understand. From the submitter of the first patch I understood
outlook allowed copy pasting links with "outlook://" URL scheme, so all
worked as expected. But don't know what he used for copy pasting the links.

One problem I have with matching "outlook:" is that you could never make a
page called "outlook" anymore. So I would rather implement it in a
different way.

One option would be to rewrite outlook URLs when they are pasted. (We can
distinguish external links from internal links when they are pasted - so
should be able to rewrite "outlook:" to "outlook://".)

The other option is to make the match more specific. For example for
"mailto:"; we also match URI scheme without the "//", but only if the link
also has a "@" in it and actually looks like an email address. So you can
still make a page called "mailto" and use it.

Regards,

Jaap

Follow ups

References