diff --git a/pypiserver/core.py b/pypiserver/core.py index a958e9d..75c9131 100755 --- a/pypiserver/core.py +++ b/pypiserver/core.py @@ -69,7 +69,8 @@ def guess_pkgname_and_version(path): path = os.path.basename(path) if path.endswith(".whl"): return _guess_pkgname_and_version_wheel(path) - + if not _archive_suffix_rx.search(path): + return path = _archive_suffix_rx.sub('', path) if '-' not in path: pkgname, version = path, '' @@ -111,7 +112,11 @@ def listdir(root): fn = os.path.join(root, dirpath, x) if not is_allowed_path(x) or not os.path.isfile(fn): continue - pkgname, version = guess_pkgname_and_version(x) + res = guess_pkgname_and_version(x) + if not res: + ##Seems the current file isn't a proper package + continue + pkgname, version = res if pkgname: yield pkgfile(fn=fn, root=root, relfn=fn[len(root) + 1:], pkgname=pkgname,