fixes opening mailto links

This commit is contained in:
Lionel Dricot 2023-09-11 17:26:57 +02:00
parent dc238309dd
commit 0666aaaa7a
2 changed files with 6 additions and 2 deletions

View File

@ -4,6 +4,7 @@
Changes since beta1
- "--sync" can optionnaly take some lists as arguments, in order to make for specific sync
- fixes gophermap being considered as gemtext files
- fixes opening mailto links
## 2.0-beta1 - September 05th 2023
This is an an experimental release. Bug reports and feedbacks are welcome on the offpunk-devel list.

View File

@ -191,6 +191,8 @@ class opencache():
return False
elif "://" in inpath:
cachepath = netcache.fetch(inpath,**kwargs)
elif inpath.startswith("mailto:"):
cachepath = inpath
elif os.path.exists(inpath):
cachepath = inpath
else:
@ -242,10 +244,11 @@ class opencache():
else:
mimetype = ansicat.get_mime(cachepath)
if mimetype == "mailto":
resp = input("Send an email to %s Y/N? " %inpath)
mail = inpath[7:]
resp = input("Send an email to %s Y/N? " %mail)
if resp.strip().lower() in ("y", "yes"):
if _HAS_XDGOPEN :
run("xdg-open mailto:%s", parameter=inpath ,direct_output=True)
run("xdg-open mailto:%s", parameter=mail,direct_output=True)
else:
print("Cannot find a mail client to send mail to %s" %inpath)
print("Please install xdg-open (usually from xdg-util package)")