Skip to content

Commit

Permalink
fixed more gdrive conflicting name bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
blawar committed Nov 7, 2019
1 parent 10918ee commit 061ce8e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Server/Controller/Api.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,21 +569,26 @@ def gdriveSearchTree(pathBits, nameIdMap, children, id = None, roots = None):
if id is None:
for name, id in roots.items():
if name == pathBits[0]:
r = gdriveSearchTree(pathBits[1:], nameIdMap, children, id, roots)
r = gdriveSearchTree(pathBits[1:], nameIdMap, children[id] if id in children else [], id, roots)
if r is not None:
return r
return None

if len(pathBits) <= 0:
return id

for folderId in nameIdMap[pathBits[0]]:
for entry in children:
if entry['name'] != pathBits[0]:
continue

folderId = entry['id']

if len(pathBits) == 1:
return folderId

if folderId in children:
for item in children[folderId]:
r = gdriveSearchTree(pathBits[1:], nameIdMap, children, folderId, roots)
for newChildren in children[folderId]:
r = gdriveSearchTree(pathBits[1:], nameIdMap, newChildren, folderId, roots)

if r is not None:
return r
Expand Down

0 comments on commit 061ce8e

Please sign in to comment.