From ef162d08b2fda0fbc32b62dd0f73368ad22b1c5e Mon Sep 17 00:00:00 2001 From: quentin-eth <78217025+quentin-eth@users.noreply.github.com> Date: Mon, 20 Feb 2023 15:36:31 +0100 Subject: [PATCH] Check .pdf extension in the url pathname. This commit allows the module to detect the PDF extension even if the url contains query string (https://my-file.pdf?variable=value). Will be usefull with S3 signed URL. --- src/components/CoolLightBox.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/CoolLightBox.vue b/src/components/CoolLightBox.vue index 8f14eae..d0142e1 100644 --- a/src/components/CoolLightBox.vue +++ b/src/components/CoolLightBox.vue @@ -1687,7 +1687,8 @@ export default { return false } - const str = new String(url) + const urlObj = new URL(url) + const str = new String(urlObj.pathname) if(str.endsWith('.pdf')){ return url } @@ -2622,4 +2623,4 @@ $breakpoints: ( transform: rotate(360deg); } } - \ No newline at end of file +