Permalink
Browse files

JS community URL trailing slash handling.

  • Loading branch information...
mukunda- committed Sep 21, 2015
1 parent 948a7cf commit a60307721ad852749cca51ec64fa5b03f92ae7ea
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/steamid.js
  2. +7 −0 test.js
View
@@ -189,7 +189,7 @@ SteamID.Parse = function( input, format, detect_raw ) {
var result = this.Parse( input, this.Format.STEAMID3 );
if( result !== null ) return result;
var matches = input.match( /^(?:https?:\/\/)?(?:www.)?steamcommunity.com\/profiles\/([0-9]+)$/ );
var matches = input.match( /^(?:https?:\/\/)?(?:www.)?steamcommunity.com\/profiles\/([0-9]+)\/*$/ );
if( matches ) {
result = this.Parse( matches[1], this.Format.STEAMID64 );
if( result !== null ) return result;
View
@@ -116,6 +116,13 @@ Tests.Add( "Conversion Test", function() {
steamid = SteamID.Parse( "http://www.steamcommunity.com/profiles/76561198069264171" );
if( steamid === null ) return false;
if( steamid.Format( SteamID.Format.STEAMID32 ) != "STEAM_1:1:54499221" ) return false;
steamid = SteamID.Parse( "http://www.steamcommunity.com/profiles/76561198069264171/" );
if( steamid === null ) return false;
if( steamid.Format( SteamID.Format.STEAMID32 ) != "STEAM_1:1:54499221" ) return false;
steamid = SteamID.Parse( "http://www.steamcommunity.com/profiles/76561198069264171////" );
if( steamid === null ) return false;
if( steamid.Format( SteamID.Format.STEAMID32 ) != "STEAM_1:1:54499221" ) return false;
PrintSubTest( "community URL 2" );
steamid = SteamID.Parse( "http://steamcommunity.com/profiles/76561198069264171" );
if( steamid === null ) return false;

0 comments on commit a603077

Please sign in to comment.