Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace deprecated String.prototype.substr() #6718

Merged
merged 1 commit into from
Apr 12, 2022
Merged

refactor: replace deprecated String.prototype.substr() #6718

merged 1 commit into from
Apr 12, 2022

Conversation

CommanderRoot
Copy link
Contributor

Description

String.prototype.substr() is deprecated so we replace it with String.prototype.slice() which works similarily but isn't deprecated.
.substr() probably isn't going away anytime soon but the change is trivial so it doesn't hurt to do it.

Related Issue

Motivation and Context

String.prototype.substr() is deprecated .

How Has This Been Tested?

I tested the return of each statement to make sure it's still the same as before

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

@update-docs
Copy link

update-docs bot commented Apr 4, 2022

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@CLAassistant
Copy link

CLAassistant commented Apr 4, 2022

CLA assistant check
All committers have signed the CLA.

@pascalwengerter pascalwengerter changed the base branch from master to transfer-6718 April 7, 2022 16:04
@pascalwengerter pascalwengerter changed the base branch from transfer-6718 to master April 7, 2022 16:05
@pascalwengerter
Copy link
Contributor

@CommanderRoot thanks for the effort, could you rebase and squash your commits so we can merge? :)

.substr() is deprecated so we replace it with functions which work similarily but aren't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
@sonarcloud
Copy link

sonarcloud bot commented Apr 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

40.0% 40.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Thank's a lot for your contribution 🤩

@@ -170,7 +170,8 @@ export default {
isSameResource(this.resourcesToDelete[0], this.currentFolder)
) {
const resourcePath = this.resourcesToDelete[0].path
parentFolderPath = resourcePath.substr(0, resourcePath.lastIndexOf('/'))
const lastSlash = resourcePath.lastIndexOf('/')
parentFolderPath = resourcePath.slice(0, lastSlash !== -1 ? lastSlash : 0)
Copy link
Member

Choose a reason for hiding this comment

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

I think I would've handled the lastSlash being -1 outside of slice, but it works as expected, so I'm fine with it. 😉

@kulmann kulmann merged commit 1059de9 into owncloud:master Apr 12, 2022
@micbar micbar mentioned this pull request May 5, 2022
45 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants