Make nautilus plugin work in python3

This commit is contained in:
Micah Lee 2019-11-28 13:26:07 -08:00
parent 58bc258507
commit 7e06872a39
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -3,7 +3,10 @@ import sys
import json
import locale
import subprocess
import urllib
try:
import urllib.request
except:
import urllib
import gi
gi.require_version("Nautilus", "3.0")
@ -67,7 +70,10 @@ class OnionShareExtension(GObject.GObject, Nautilus.MenuProvider):
def url2path(self, url):
file_uri = url.get_activation_uri()
arg_uri = file_uri[7:]
path = urllib.url2pathname(arg_uri)
try:
path = urllib.request.url2pathname(arg_uri)
except:
path = urllib.url2pathname(arg_uri)
return path
def exec_onionshare(self, filenames):