Skip to content

Commit

Permalink
Add exception handling for invalid Drive Key
Browse files Browse the repository at this point in the history
  • Loading branch information
l3v11 authored Dec 21, 2022
1 parent 7ff4611 commit cd8b49c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ SearchX is a multipurpose Telegram bot written in Python for Google Drive
- Set data permission in Google Drive
- Size Limit support for Clone, Compression and Extraction tasks
- Destination change support for Clone tasks
- MongoDB support for storing the list of authorized users
- MongoDB database support
- Bookmark support for storing Destination Drive IDs into database
- Support for storing the list of authorized users into database
- Index Link support
- Multi-token telegraph support
- Multi-page telegraph page results
Expand Down Expand Up @@ -62,8 +64,11 @@ cancel - Cancel a task
status - Get status of all tasks
share - Set data permission in Google Drive
del - Delete data from Google Drive
authorize - Grant authorization of an user
unauthorize - Revoke authorization of an user
addbm - Add bookmark of a destination drive
rembm - Remove bookmark of a destination drive
bookmarks - Get the list of bookmarked destination drives
auth - Grant authorization of an user
unauth - Revoke authorization of an user
users - Get the list of authorized users
shell - Execute shell commands
eval - Evaluate Python expressions
Expand Down
10 changes: 8 additions & 2 deletions bot/modules/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,20 @@ def cloneNode(update, context):
link = args[1].strip()
try:
key = args[2].strip()
dest_id = BOOKMARKS[key]
try:
dest_id = BOOKMARKS[key]
except KeyError:
return sendMessage("Invalid Drive Key", context.bot, update.message)
except IndexError:
pass
if reply_to:
link = reply_to.text.split(maxsplit=1)[0].strip()
try:
key = args[1].strip()
dest_id = BOOKMARKS[key]
try:
dest_id = BOOKMARKS[key]
except KeyError:
return sendMessage("Invalid Drive Key", context.bot, update.message)
except IndexError:
pass
is_gdtot = is_gdtot_link(link)
Expand Down

0 comments on commit cd8b49c

Please sign in to comment.