33import sublime
44import sublime_plugin
55
6+ from os .path import isabs
7+
68from ..console_write import console_write
79from ..settings import pc_settings_filename
810from ..show_error import show_error
@@ -31,15 +33,20 @@ def run(self, url=None, unattended=False):
3133 url = url .strip ()
3234
3335 if re .match (r'^(?:file:///|https?://)' , url , re .I ) is None :
34- output_fn = console_write if unattended else show_error
35- output_fn (
36- '''
37- Unable to add the repository "%s" since it does not appear to
38- be served via HTTP (http:// or https://).
39- ''' ,
40- url
41- )
42- return
36+ if not isabs (url ):
37+ output_fn = console_write if unattended else show_error
38+ output_fn (
39+ '''
40+ Unable to add the repository "%s" since it does not appear to
41+ be a local URL (file://) or served via HTTP (http:// or https://).
42+ ''' ,
43+ url
44+ )
45+ return
46+
47+ if url [0 ] != "/" :
48+ url = "/" + url .replace ("\\ " , "/" )
49+ url = "file://" + url
4350
4451 settings = sublime .load_settings (pc_settings_filename ())
4552 repositories = settings .get ('repositories' )
@@ -54,7 +61,7 @@ def run(self, url=None, unattended=False):
5461 return
5562
5663 sublime .active_window ().show_input_panel (
57- 'GitHub, GitLab or BitBucket Web URL, or Custom JSON Repository URL' ,
64+ 'GitHub, GitLab, BitBucket or JSON repository URL' ,
5865 '' ,
5966 self .run ,
6067 None ,
0 commit comments