From 4f7e4ad65e85e044c3e9b6773bf1ef100ef3b2d6 Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 22 May 2014 09:22:58 -0400 Subject: [PATCH] fix #365 parsing media limit --- lib/channel/opts.js | 9 ++++++++- lib/utilities.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/channel/opts.js b/lib/channel/opts.js index 7590972d..9c7450f7 100644 --- a/lib/channel/opts.js +++ b/lib/channel/opts.js @@ -1,5 +1,6 @@ var ChannelModule = require("./module"); var Config = require("../config"); +var Utilities = require ("../utilities"); function OptionsModule(channel) { ChannelModule.apply(this, arguments); @@ -120,7 +121,13 @@ OptionsModule.prototype.handleSetOptions = function (user, data) { } if ("maxlength" in data) { - var ml = parseInt(data.maxlength); + var ml = 0; + if (typeof data.maxlength !== "number") { + ml = Utilities.parseTime(data.maxlength); + } else { + ml = parseInt(data.maxlength); + } + if (isNaN(ml) || ml < 0) { ml = 0; } diff --git a/lib/utilities.js b/lib/utilities.js index 6aa03738..81848173 100644 --- a/lib/utilities.js +++ b/lib/utilities.js @@ -176,7 +176,7 @@ }, root.parseTime = function (time) { - var parts = time.split(":"); + var parts = time.split(":").reverse(); var seconds = 0; switch (parts.length) { case 3: