From 36e7f06608eb339082c2e905133bd7d83d9b36f0 Mon Sep 17 00:00:00 2001
From: hardythe1
Date: Thu, 3 Jul 2014 12:42:20 +0530
Subject: Correcting JS: file names with '.' in it apart from file extension
 was not allowing .png files to be uploaded

---
 tbc/templates/tbc/upload-content.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tbc/templates/tbc/upload-content.html b/tbc/templates/tbc/upload-content.html
index 5f6025c..62d2941 100644
--- a/tbc/templates/tbc/upload-content.html
+++ b/tbc/templates/tbc/upload-content.html
@@ -15,7 +15,7 @@ function validate_content()
             alert("Chapter names & file fields cannot be empty !!");
             return false;
         }
-        if(extension[1] == "ipynb")
+        if(extension.slice(Math.max(extension.length - 1, 1)) == "ipynb")
             continue;
         else
             alert("Oops !! You can upload only Ipython Notebooks (.ipynb extension)");    
@@ -32,7 +32,7 @@ function validate_content()
             return false;
         }
 
-        if(extension[1] == "png")
+        if(extension.slice(Math.max(extension.length - 1, 1)) == "png")
             continue;
         else
             alert("Only .png files are allowed for screenshots");    
-- 
cgit