Merge pull request #895 from mattrose/865-file-links-not-clickable-if-the-root-dir-has-a-underscore
Properly parse file:/// URIs
This commit is contained in:
commit
3c0abdf6d6
|
@ -300,6 +300,7 @@ class Terminal(Gtk.VBox):
|
|||
registry.load_plugins(force)
|
||||
|
||||
def _add_regex(self, name, re):
|
||||
dbg(f"adding regex: {re}")
|
||||
match = -1
|
||||
if regex.FLAGS_PCRE2:
|
||||
try:
|
||||
|
@ -323,19 +324,23 @@ class Terminal(Gtk.VBox):
|
|||
passchars = "-A-Za-z0-9,?;.:/!%$^*&~\"#'"
|
||||
hostchars = r"-A-Za-z0-9:\[\]"
|
||||
pathchars = "-A-Za-z0-9_$.+!*(),;:@&=?/~#%'"
|
||||
schemes = "(news:|telnet:|nntp:|file:/|https?:|ftps?:|webcal:|ssh:)"
|
||||
schemes = "(news:|telnet:|nntp:|https?:|ftps?:|webcal:|ssh:)"
|
||||
user = "[" + userchars + "]+(:[" + passchars + "]+)?"
|
||||
urlpath = "/[" + pathchars + "]*[^]'.}>) \t\r\n,\\\"]"
|
||||
|
||||
lboundry = "\\b"
|
||||
rboundry = "\\b"
|
||||
|
||||
re = (lboundry + "file:/" + "//?(:[0-9]+)?(" + urlpath + ")" +
|
||||
rboundry + "/?")
|
||||
self._add_regex('file', re)
|
||||
|
||||
re = (lboundry + schemes +
|
||||
"//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" +
|
||||
urlpath + ")?" + rboundry + "/?")
|
||||
self._add_regex('full_uri', re)
|
||||
|
||||
if self.matches['full_uri'] == -1:
|
||||
if self.matches['full_uri'] == -1 or self.matches['file'] == -1:
|
||||
err ('Terminal::update_url_matches: Failed adding URL matches')
|
||||
else:
|
||||
re = (lboundry +
|
||||
|
|
Loading…
Reference in New Issue