Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/soundjs/Sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,14 @@ this.createjs = this.createjs || {};

/**
* The RegExp pattern used to parse file URIs. This supports simple file names, as well as full domain URIs with
* query strings. The resulting match is: protocol:$1 domain:$2 path:$3 file:$4 extension:$5 query:$6.
* query strings. The resulting match is: protocol:$1 domain:$2 path:$3 file:$4 extension:$5 query:$6 query-file:$7 query-extension:$8.
* "query-file" and "query-extension" are provided if the source file is defined by a query string.
* @property FILE_PATTERN
* @type {RegExp}
* @static
* @protected
*/
s.FILE_PATTERN = /^(?:(\w+:)\/{2}(\w+(?:\.\w+)*\/?))?([/.]*?(?:[^?]+)?\/)?((?:[^/?]+)\.(\w+))(?:\?(\S+)?)?$/;
s.FILE_PATTERN = /^(?:(\w+:)\/{2}(\w+(?:\.\w+)*\/?))?([\/.]*?(?:[^?]+)?\/)?(?:((?:[^\/?]+)\.(\w+))|(?:[^\/?]+))(?:\?((?:(?:[^&]*?[\/=])?(?:((?:(?:[^\/?&=]+)\.(\w+)))\S*?)|\S+))?)?$/;


// Class Public properties
Expand Down Expand Up @@ -1191,23 +1192,22 @@ this.createjs = this.createjs || {};
s._parsePath = function (value) {
if (typeof(value) != "string") {value = value.toString();}

/*var match = value.match(s.FILE_PATTERN);
if (match == null) {return false;}

var name = match[4];
var ext = match[5];*/
//Changed how extensions and filenames are grabbed from the url to add simple support for
//urls that use php services & query string params to specify the file
var ext, name, origExt;
if(value.indexOf(".") >= 0)
{
ext = value.substr(value.lastIndexOf(".")+1);
if(ext.indexOf("?") > 0)
ext = ext.substring(0, ext.indexOf("?"));
name = value.substring(0, value.lastIndexOf("."));
if(name.indexOf("/") >= 0)
name = name.substr(name.lastIndexOf("/")+1);
origExt = ext;
var match = value.match(s.FILE_PATTERN);
if (match === null) {return false;}

var name = '';
var ext = '';
var origExt = '';
if (s.SUPPORTED_EXTENSIONS.indexOf(match[5]) >= 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to stay consistent with the code style convention, brackets should be on the next line.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the code in this file keeps the brackets in the same line, the original line 1203 being an exception. I'm happy to change it, but I just want to make certain since dropping it down will be inconsistent with the rest of this file.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, my bad, you are correct. Springroll follows that convention but this is the CreateJS fork. So disregard.

name = match[4];
origExt = ext = match[5];
} else if (s.SUPPORTED_EXTENSIONS.indexOf(match[8]) >= 0) {
name = match[7];
origExt = ext = match[8];
} else {
return null;
}

var c = s.capabilities;
Expand Down