Skip to content

Commit

Permalink
Add remote path support for Windows and certain reserved characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtth committed Jun 17, 2015
1 parent 64910cb commit 6581150
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
12 changes: 11 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
HdfsCLI
=======


Version 1.0.1 (2015/06/17)
--------------------------

* Added support for Windows.
* Added support for remote filepaths with `=` characters.


Version 0.3.0 (2014/11/14)
--------------------------

Expand All @@ -11,13 +19,15 @@ Breaking changes:
* Renamed `--info` command to `--list`.
* Made `--interactive` the new default command.


Version 0.2.6 (2014/08/04)
--------------------------

* Added parallelized downloading.
* Added Avro-format reading and writing.
* Added `hdfs.ext.dataframe` extension.



Version 0.2.0 (2014/04/26)
--------------------------

Expand Down
2 changes: 1 addition & 1 deletion hdfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"""HdfsCLI."""

__version__ = '1.0.0'
__version__ = '1.0.1'

import logging as lg
try:
Expand Down
2 changes: 1 addition & 1 deletion hdfs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def expand_latest(match):
# #LATEST expansion (could cache the pattern, but not worth it)

self._logger.debug('Resolved path %r to %r.', hdfs_path, path)
return quote(path)
return quote(path, '/=').replace(os.sep, '/')

def content(self, hdfs_path):
"""Get content summary for a file or folder on HDFS.
Expand Down
5 changes: 5 additions & 0 deletions test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ def test_resolve_filename(self):
encoded = self.client.resolve(path)
eq_(encoded.split('/')[-2:], ['fo%26o', 'a%3F%25a'])

def test_resolve_filename_with_safe_characters(self):
path = 'foo=1'
encoded = self.client.resolve(path)
eq_(encoded.split('/')[-1], 'foo=1')

def test_create_file_with_reserved_characters(self):
path = 'fo&o/a?a'
self.client.write(path, data='hello')
Expand Down

0 comments on commit 6581150

Please sign in to comment.