From 5ae162fb21e213f8fa7d2cefd4bc4138c0b66fa1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 17 Apr 2013 12:45:37 -0400 Subject: [PATCH] fixes #146 - User creation screen - image selection --- MediaBrowser.WebDashboard/ApiClient.js | 14 +++++++++----- MediaBrowser.WebDashboard/packages.config | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js index 420b75d93..bb8de833a 100644 --- a/MediaBrowser.WebDashboard/ApiClient.js +++ b/MediaBrowser.WebDashboard/ApiClient.js @@ -786,7 +786,11 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { throw new Error("null imageType"); } - if (!file || !file.type.match('image.*')) { + if (!file) { + throw new Error("File must be an image."); + } + + if (file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/jpeg") { throw new Error("File must be an image."); } @@ -1841,7 +1845,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { throw new Error("null name"); } - var url = self.getUrl("Users/{UserId}/Persons/" + encodeName(name) + "/Counts"); + var url = self.getUrl("Users/" + userId + "/Persons/" + encodeName(name) + "/Counts"); return self.ajax({ type: "GET", @@ -1863,7 +1867,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { throw new Error("null name"); } - var url = self.getUrl("Users/{UserId}/Genres/" + encodeName(name) + "/Counts"); + var url = self.getUrl("Users/" + userId + "/Genres/" + encodeName(name) + "/Counts"); return self.ajax({ type: "GET", @@ -1875,7 +1879,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { /** Gets a variety of item counts that a studio appears in */ - self.getStudiosItemCounts = function (userId, name) { + self.getStudioItemCounts = function (userId, name) { if (!userId) { throw new Error("null userId"); @@ -1885,7 +1889,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { throw new Error("null name"); } - var url = self.getUrl("Users/{UserId}/Studios/" + encodeName(name) + "/Counts"); + var url = self.getUrl("Users/" + userId + "/Studios/" + encodeName(name) + "/Counts"); return self.ajax({ type: "GET", diff --git a/MediaBrowser.WebDashboard/packages.config b/MediaBrowser.WebDashboard/packages.config index a4c910f73..e88d7b2d2 100644 --- a/MediaBrowser.WebDashboard/packages.config +++ b/MediaBrowser.WebDashboard/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file