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

Clone the passed URI in CallBuilder constructor, to not mutate the outside ref #473

Merged
merged 2 commits into from
Jan 20, 2020

Conversation

challet
Copy link
Contributor

@challet challet commented Dec 28, 2019

Hello,

The passed URI arg is modified on a later call() inside the checkFilter method, while the outside reference still pointing on it, making it to change.

It was most probably harmless since all the CallBuilder implementations are supposed to be constructed from inside a Server method, where it seems they are already cloned by re-instantiating them (this.serverURL being already a URI instance) :

URI(this.serverURL as any)

I didn't removed those URI calls from Server methods and I rather ask for opinions here.

Copy link
Contributor

@abuiles abuiles left a comment

Choose a reason for hiding this comment

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

@challet thanks for this! I think what you are proposing makes sense and avoid unexpected surprises.

@morleyzhi WDYT?

@abuiles abuiles merged commit 7fd0397 into stellar:master Jan 20, 2020
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.

2 participants