Do not view parent source of FTP directories.

This commit is contained in:
Bastian Kleineidam 2011-02-11 12:42:04 +01:00
parent db6a3669b3
commit 1fada7f316
2 changed files with 10 additions and 7 deletions

View file

@ -4,7 +4,7 @@ Fixes:
- checking: Do not remove CGI parameters when joining URLs.
- checking: Correctly detect empty FTP paths as directories.
- gui: Remove old context menu action to view URL properties.
- gui: Disable viewing of parent URL source if its a local directory.
- gui: Disable viewing of parent URL source if it's a directory.
Changes:
- gui: Use Alt-key shortcuts for menu entries.

View file

@ -48,10 +48,13 @@ class ContextMenu (QtGui.QMenu):
parent = url_data.parent_url
if not parent:
return False
# Directory contents are dynamically generated, so it makes
# no sense in viewing/editing them.
if parent.startswith(u"file:"):
urlparts = urlparse.urlsplit(parent)
return not os.path.isdir(get_os_filename(urlparts[2]))
return (parent.startswith(u"http:") or
parent.startswith(u"https:") or
parent.startswith(u"ftp:") or
parent.startswith(u"ftps:"))
path = urlparse.urlsplit(parent)[2]
return not os.path.isdir(get_os_filename(path))
if parent.startswith((u"ftp:", u"ftps:")):
path = urlparse.urlsplit(parent)[2]
return bool(path) and not path.endswith(u'/')
# Only HTTP left
return parent.startswith((u"http:", u"https:"))