Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/subversion_file_system.py |
| diff --git a/chrome/common/extensions/docs/server2/subversion_file_system.py b/chrome/common/extensions/docs/server2/subversion_file_system.py |
| index 2d9db99c549f7b2603f6260a99b49491df7e0c75..b4f83d6dd10300b8d81d7f28d6ff6c8e5322d0b0 100644 |
| --- a/chrome/common/extensions/docs/server2/subversion_file_system.py |
| +++ b/chrome/common/extensions/docs/server2/subversion_file_system.py |
| @@ -118,15 +118,17 @@ class SubversionFileSystem(FileSystem): |
| return StatInfo('0', {}) |
| def Stat(self, path): |
| - directory = path.rsplit('/', 1)[0] |
| + if '/' in path: |
| + directory, filename = path.rsplit('/', 1) |
|
Yoyo Zhou
2013/05/03 20:01:24
How about os.path.dirname and os.path.basename?
not at google - send to devlin
2013/05/03 20:41:25
Except these are URLs not paths, so needs to be ex
Yoyo Zhou
2013/05/03 20:52:47
The os.path functions seem to work just fine on UR
not at google - send to devlin
2013/05/03 21:06:49
did you test on windows?
|
| + else: |
| + directory, filename = ('', path) |
| result = self._stat_fetcher.Fetch(directory + '/') |
| if result.status_code == 404: |
| raise FileNotFoundError( |
| 'Got 404 when fetching %s from %s for Stat' % (path, directory)) |
| stat_info = self._CreateStatInfo(result.content) |
| - if not path.endswith('/'): |
| - filename = path.rsplit('/', 1)[-1] |
| - if filename not in stat_info.child_versions: |
| - raise FileNotFoundError('%s was not in child versions' % filename) |
| - stat_info.version = stat_info.child_versions[filename] |
| - return stat_info |
| + if path.endswith('/'): |
| + return stat_info |
| + if filename not in stat_info.child_versions: |
| + raise FileNotFoundError('%s was not in child versions' % filename) |
| + return StatInfo(stat_info.child_versions[filename]) |