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

Replace deprecated String.prototype.substr() #684

Merged
merged 1 commit into from
Apr 9, 2022
Merged

Replace deprecated String.prototype.substr() #684

merged 1 commit into from
Apr 9, 2022

Conversation

CommanderRoot
Copy link
Contributor

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.

@CarlSchwan
Copy link
Member

Thanks :)

@CarlSchwan
Copy link
Member

/compile amend /

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
@CarlSchwan CarlSchwan merged commit 319c08e into nextcloud:master Apr 9, 2022
@nickvergessen
Copy link
Member

The app seems to break recently and this is the only change since 23 I found that could be related at all.
Ref #699

Can we revert it?

nickvergessen added a commit that referenced this pull request Apr 27, 2022
Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen mentioned this pull request Apr 27, 2022
nextcloud-command pushed a commit that referenced this pull request Apr 27, 2022
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
nickvergessen added a commit that referenced this pull request Apr 27, 2022
backportbot-nextcloud bot pushed a commit that referenced this pull request Apr 27, 2022
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
nextcloud-command pushed a commit that referenced this pull request Apr 27, 2022
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@CommanderRoot
Copy link
Contributor Author

Did the revert fix the issue? I have re-checked the code in this PR and the only thing I could find which could result in a different output with .slice() instead of .substr() was on this line 319c08e#diff-a399f4f7618b3592834a1e57a93657c1618c0df173b27e903e5493a63e0a0853R37 if endPos is -1.
So replacing it with

const message = json.slice(startPos, endPos !== -1 ? endPos : 0);

would fix that as well.

@nickvergessen
Copy link
Member

The backport is still pending #704

nickvergessen added a commit that referenced this pull request Apr 28, 2022
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.

3 participants