From c8ace32cbab3694e6d73697d61a5e9e77f3abfa6 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Tue, 22 Dec 2020 14:36:39 -0500 Subject: [PATCH] Make Google Drive URL determination function more flexible. This way it won't do bad things to non-Drive URLs. --- _includes/functions/get_drive_url.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/_includes/functions/get_drive_url.html b/_includes/functions/get_drive_url.html index 75d5f320..c8f90a35 100644 --- a/_includes/functions/get_drive_url.html +++ b/_includes/functions/get_drive_url.html @@ -1,4 +1,9 @@ -{% assign temp = include.url | split: 'open?id=' %} -{% assign temp2 = temp[1] %} -{% assign out_url = 'https://drive.google.com/uc?export=&confirm=no_antivirus&id='| append: temp2 %} +{% assign url = include.url %} +{% if url contains 'open?id=' %} + {% assign temp = url | split: 'open?id=' %} + {% assign temp2 = temp[1] %} + {% assign out_url = 'https://drive.google.com/uc?export=&confirm=no_antivirus&id='| append: temp2 %} +{% else %} + {% assign out_url = url %} +{% endif %} {{ out_url }}