Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Replace deprecated String.prototype.substr() #1035

Merged
merged 2 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/change-replace-deprecated-substr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Change: Replace deprecated String.prototype.substr()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Change: Replace deprecated String.prototype.substr()
Enhancement: Replace deprecated String.prototype.substr()

Since this isn't a user-facing breaking change it counts as enhancement in SemVer, could you update the changelog item filename & heading?:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I updated the file as requested


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
2 changes: 1 addition & 1 deletion src/systemTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion tests/loginTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down