From 842b3c06eff0f181a91ecc0a92952b3794702802 Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Mon, 4 Apr 2022 10:13:33 +0200 Subject: [PATCH 1/2] Replace deprecated String.prototype.substr() .substr() is deprecated so we replace it with functions which work similarily but aren't deprecated Signed-off-by: Tobias Speicher --- changelog/unreleased/change-replace-deprecated-substr | 7 +++++++ src/systemTags.js | 2 +- tests/loginTest.js | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/change-replace-deprecated-substr diff --git a/changelog/unreleased/change-replace-deprecated-substr b/changelog/unreleased/change-replace-deprecated-substr new file mode 100644 index 000000000..c1d1271de --- /dev/null +++ b/changelog/unreleased/change-replace-deprecated-substr @@ -0,0 +1,7 @@ +Change: Replace deprecated String.prototype.substr() + +We've replaced all occurrences of the deprecated String.prototype.substr() +function with String.prototype.slice() which works similarly but isn't +deprecated. + +https://github.com/owncloud/owncloud-sdk/pull/1035 diff --git a/src/systemTags.js b/src/systemTags.js index 199e3db0e..c93b32ec4 100644 --- a/src/systemTags.js +++ b/src/systemTags.js @@ -52,7 +52,7 @@ class SystemTags { return Promise.reject(new Error('Error: ' + result.status)) } else { const contentLocation = result.res.headers['content-location'] - return Promise.resolve(parseInt(contentLocation.substr(contentLocation.lastIndexOf('/') + 1), 10)) + return Promise.resolve(parseInt(contentLocation.slice(contentLocation.lastIndexOf('/') + 1), 10)) } }) } diff --git a/tests/loginTest.js b/tests/loginTest.js index d6d4a2cf9..b72b02db8 100644 --- a/tests/loginTest.js +++ b/tests/loginTest.js @@ -3,7 +3,7 @@ describe('Main: Currently testing Login and initLibrary,', function () { var config = require('./config/config.json') // CURRENT TIME - var timeRightNow = Math.random().toString(36).substr(2, 9) + var timeRightNow = Math.random().toString(36).slice(2, 11) // LIBRARY INSTANCE var oc From 94f40aaf453bbde8a9f8242f99661b2d2e1289e7 Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Mon, 4 Apr 2022 10:34:48 +0200 Subject: [PATCH 2/2] Fix changelog --- ...-deprecated-substr => enhancement-replace-deprecated-substr} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename changelog/unreleased/{change-replace-deprecated-substr => enhancement-replace-deprecated-substr} (78%) diff --git a/changelog/unreleased/change-replace-deprecated-substr b/changelog/unreleased/enhancement-replace-deprecated-substr similarity index 78% rename from changelog/unreleased/change-replace-deprecated-substr rename to changelog/unreleased/enhancement-replace-deprecated-substr index c1d1271de..c2f7bc59c 100644 --- a/changelog/unreleased/change-replace-deprecated-substr +++ b/changelog/unreleased/enhancement-replace-deprecated-substr @@ -1,4 +1,4 @@ -Change: Replace deprecated String.prototype.substr() +Enhancement: Replace deprecated String.prototype.substr() We've replaced all occurrences of the deprecated String.prototype.substr() function with String.prototype.slice() which works similarly but isn't