Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
fix path length checks on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ergoithz committed Sep 9, 2017
1 parent e93fb42 commit f450b52
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ browsepy

.. image:: http://img.shields.io/pypi/v/browsepy.svg?style=flat-square
:target: https://pypi.python.org/pypi/browsepy/
:alt: Version: 0.5.5
:alt: Version: 0.5.6

.. image:: https://img.shields.io/badge/python-2.7%2B%2C%203.3%2B-FFC100.svg?style=flat-square
:target: https://pypi.python.org/pypi/browsepy/
Expand Down
2 changes: 1 addition & 1 deletion browsepy/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

app = 'browsepy'
description = 'Simple web file browser'
version = '0.5.5'
version = '0.5.6'
license = 'MIT'
author_name = 'Felipe A. Hernandez'
author_mail = '[email protected]'
Expand Down
2 changes: 1 addition & 1 deletion browsepy/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def pathconf(path,
if pathconf_fnc and pathconf_names:
return {key: pathconf_fnc(path, key) for key in pathconf_names}
if os_name == 'nt':
maxpath = 247 if isdir_fnc(path) else 259 # 260 minus <END>
maxpath = 246 if isdir_fnc(path) else 259 # 260 minus <END>
else:
maxpath = 255 # conservative sane default
return {
Expand Down
4 changes: 2 additions & 2 deletions browsepy/tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def test_pathconf(self):
isdir_fnc=lambda x: True
)
pcfg = self.module.pathconf('c:\\a', **kwargs)
self.assertEqual(pcfg['PC_PATH_MAX'], 247)
self.assertEqual(pcfg['PC_NAME_MAX'], 243)
self.assertEqual(pcfg['PC_PATH_MAX'], 246)
self.assertEqual(pcfg['PC_NAME_MAX'], 242)

def test_getcwd(self):
self.assertIsInstance(self.module.getcwd(), self.module.unicode)
Expand Down
5 changes: 4 additions & 1 deletion browsepy/tests/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ def test_fmt_size(self):
def test_secure_filename(self):
self.assertEqual(self.module.secure_filename('/path'), 'path')
self.assertEqual(self.module.secure_filename('..'), '')
self.assertEqual(self.module.secure_filename('::'), '')
self.assertEqual(
self.module.secure_filename('::'),
'__' if os.name == 'nt' else ''
)
self.assertEqual(self.module.secure_filename('\0'), '_')
self.assertEqual(self.module.secure_filename('/'), '')
self.assertEqual(self.module.secure_filename('C:\\'), '')
Expand Down

0 comments on commit f450b52

Please sign in to comment.