From ca6ad6d071d22cd3a17f207e6a0021b7eb1409d5 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Wed, 16 Aug 2017 17:58:13 +0200 Subject: [PATCH] Don't use OC.generateUrl to generate API endpoint URLs OC.generateUrl doesn't permit to know applications endpoint for this app, instead use window.location.href to retrieve the app current URL and generate endpoints from this This fixes issue #197 --- js/public/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/public/app.js b/js/public/app.js index 8b6fe68..2da6501 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -105,7 +105,12 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile' $scope.lastSearch = ''; $scope.generateUrl = function (endpoint) { - return OC.generateUrl('/apps/ocsms' + endpoint); + var winRegexp = /(.*)\/ocsms.*/; + var match = winRegexp.exec(window.location.href); + if (match.length != 2) { + console.log("A very bad error happened when parsing window location"); + } + return match[1] + '/ocsms' + endpoint; }; // Settings