Skip to content

Commit

Permalink
validate path in FTPFS.geturl
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Jun 2, 2019
1 parent a850810 commit e07d82a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.5.6] - Unreleased

### Added

- Implemented geturl in FTPFS zmej-serow

## [2.4.5] - 2019-05-05

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion fs/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Version, used in module and setup.py.
"""
__version__ = "2.4.5"
__version__ = "2.4.6a0"
7 changes: 4 additions & 3 deletions fs/ftpfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,14 @@ def ftp(self):
"""~ftplib.FTP: the underlying FTP client.
"""
return self._get_ftp()

def geturl(self, path, purpose="download"):
# type: (str, str) -> Text
"""Get FTP url for resource."""
_path = self.validatepath(path)
if purpose != "download":
raise errors.NoURL(path, purpose, "No such purpose")
return "{}/{}".format(self.ftp_url, path)
raise errors.NoURL(_path, purpose)
return "{}{}".format(self.ftp_url, _path)

def _get_ftp(self):
# type: () -> FTP
Expand Down

0 comments on commit e07d82a

Please sign in to comment.