ensure non url chars are not used for pad names or pad links

pull/46/head
Peter 'Pita' Martischka 2011-07-26 16:17:02 +01:00
parent e56ef9c26e
commit b43c7e7c99
2 changed files with 12 additions and 3 deletions

View File

@ -20,6 +20,15 @@ var socket;
$(document).ready(function()
{
//test if the url is proper, means without any ? or # that doesn't belong to a url
//if it isn't proper, clean the url a do a redirect
var padId = document.location.pathname.substring(document.location.pathname.lastIndexOf("/") + 1);
var expectedURL = document.location.href.substring(0,document.location.href.lastIndexOf("/") ) + "/" + padId;
if(expectedURL != document.location.href)
{
document.location = expectedURL;
}
handshake();
});
@ -82,8 +91,8 @@ function handshake()
socket.once('connect', function()
{
var padId = document.URL.substring(document.URL.lastIndexOf("/") + 1);
var padId = document.location.pathname.substring(document.location.pathname.lastIndexOf("/") + 1);
document.title = document.title + " | " + padId;
var token = readCookie("token");

View File

@ -52,7 +52,7 @@
$(window).load(function ()
{
//get the padId out of the url
var urlParts= document.URL.split("/");
var urlParts= document.pathname.split("/");
padId = urlParts[urlParts.length-2];
//set the title