Skip to content

Commit 29d276e

Browse files
author
SM_SAYEED
committed
url extraction fixed
1 parent da39520 commit 29d276e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,16 @@ def add_drive_clip():
553553
description = request.form.get('description', '').strip()
554554

555555
def extract_drive_id(link):
556+
# Accept both full share URLs and raw file IDs
556557
match = re.search(r'/d/([a-zA-Z0-9_-]+)', link)
557558
if match:
558559
return match.group(1)
559560
match = re.search(r'id=([a-zA-Z0-9_-]+)', link)
560561
if match:
561562
return match.group(1)
563+
# Fallback: raw ID
564+
if re.match(r'^[a-zA-Z0-9_-]{10,}$', link):
565+
return link
562566
return None
563567

564568
file_id = extract_drive_id(link)
@@ -577,6 +581,7 @@ def extract_drive_id(link):
577581

578582
return render_template('add_drive_clip.html', message=message)
579583

584+
580585
# --- Print routes for debugging (optional, can comment out) ---
581586
for rule in app.url_map.iter_rules():
582587
print(rule.endpoint, rule)

0 commit comments

Comments
 (0)