Skip to content

Commit acbb25c

Browse files
committed
App: navbar takes filelinks and ids
[skip ci]
1 parent e8697d1 commit acbb25c

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

scripts/gdrive_app.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,26 @@ def on_address_bar_return(self):
542542
query = self.address_bar.text()
543543
if not query:
544544
return
545+
546+
file_id = gdrive_base.link_to_id(query)
547+
if file_id:
548+
file_data = self.gcache.get_item(file_id)
549+
if not file_data:
550+
QMessageBox.warning(self, "File not found", f"The file with id {file_id} was not found in the cache.")
551+
return
552+
if file_data['mimeType'] == 'application/vnd.google-apps.folder':
553+
self.load_folder(file_id, file_data['name'], add_history=True)
554+
return
555+
parent = self.gcache.get_item(file_data['parent_id'])
556+
if not parent:
557+
assert not file_data['owners'][0]['me']
558+
self.load_root("shared_with_me", highlight_fileid=file_id)
559+
return
560+
if len(parent['id']) == 19:
561+
self.load_root("my_drive", add_history=True, highlight_fileid=file_id)
562+
return
563+
self.load_folder(parent['id'], parent['name'], add_history=True, highlight_fileid=file_id)
564+
return
545565

546566
import gdrive
547567
try:

0 commit comments

Comments
 (0)