Skip to content

Commit

Permalink
Adding forward slash support in namespace name because it is valid, s…
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Aichinger committed Dec 9, 2014
1 parent 08f8b52 commit 16cce71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/Storage.as
@@ -1,4 +1,4 @@
/**
/**
* SwfStore - a JavaScript library for cross-domain flash cookies
*
* http://github.com/nfriedly/Javascript-Flash-Cookies
Expand Down Expand Up @@ -49,7 +49,7 @@ package {
/**
* Namespace portion provided by JS is tested against this to avoid XSS
*/
private var namespaceCheck:RegExp = /^[a-z0-9_]+$/i;
private var namespaceCheck:RegExp = /^[a-z0-9_\/]+$/i;

/**
* Text field used by local logging
Expand Down Expand Up @@ -93,7 +93,6 @@ package {
Security.allowDomain("*");
Security.allowInsecureDomain("*");


// try to initialize our lso
try{
dataStore = SharedObject.getLocal(this.loaderInfo.parameters.namespace);
Expand Down
6 changes: 3 additions & 3 deletions src/swfstore.js
Expand Up @@ -33,7 +33,7 @@

var counter = 0; // a counter for element id's and whatnot

var alpnum = /[^a-z0-9_]/ig; //a regex to find anything thats not letters and numbers
var alpnum = /[^a-z0-9_\/]/ig; //a regex to find anything thats not letters and numbers

/**
* SwfStore constructor - creates a new SwfStore object and embeds the .swf into the web page.
Expand Down Expand Up @@ -87,7 +87,7 @@

// a couple of basic timesaver functions
function id() {
return "SwfStore_" + config.namespace + "_" + (counter++);
return "SwfStore_" + config.namespace.replace("/", "_") + "_" + (counter++);
}

function div(visible) {
Expand Down Expand Up @@ -139,7 +139,7 @@

var swfName = id();

var flashvars = "namespace=" + config.namespace;
var flashvars = "namespace=" + encodeURIComponent(config.namespace);


swfContainer.innerHTML = '<object height="100" width="500" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="' +
Expand Down

0 comments on commit 16cce71

Please sign in to comment.