import json
import logging
from StringIO import StringIO
+import posixpath
from appengine_blobstore import AppEngineBlobstore, BLOBSTORE_GITHUB
from appengine_url_fetcher import AppEngineUrlFetcher
from docs_server_utils import StringIdentity
from file_system import FileSystem, StatInfo
from future import Future
+from path_util import IsDirectory
import url_constants
from zipfile import ZipFile, BadZipfile
if zip_file is None:
logging.error('Bad github zip file.')
return ''
- prefix = zip_file.namelist()[0][:-1]
+ prefix = zip_file.namelist()[0]
return zip_file.read(prefix + path)
def _ListDir(self, path):
return []
filenames = zip_file.namelist()
# Take out parent directory name (GoogleChrome-chrome-app-samples-c78a30f)
- filenames = [f[len(filenames[0]) - 1:] for f in filenames]
+ filenames = [f[len(filenames[0]):] for f in filenames]
# Remove the path of the directory we're listing from the filenames.
filenames = [f[len(path):] for f in filenames
if f != path and f.startswith(path)]
self._GetZip(version)
result = {}
for path in paths:
- if path.endswith('/'):
+ if IsDirectory(path):
result[path] = self._ListDir(path)
else:
result[path] = self._ReadFile(path)