Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

PathString implicit string converters are asymmetric #690

Closed
jkotalik opened this issue Aug 16, 2016 · 6 comments
Closed

PathString implicit string converters are asymmetric #690

jkotalik opened this issue Aug 16, 2016 · 6 comments
Assignees
Milestone

Comments

@jkotalik
Copy link
Contributor

In PathString.cs

public static implicit operator PathString(string s)
        {
            return new PathString(s);
        }

Will create the unescaped new PathString while

        public static implicit operator string(PathString path)
        {
            return path.ToString();
        }

Will create the escaped ToString.

@jkotalik jkotalik added the bug label Aug 16, 2016
@davidfowl
Copy link
Member

That's not great...

@khellang
Copy link
Contributor

khellang commented Aug 18, 2016

I thought that was the whole point of PathString? Make it easier to do "the right thing" by expecting unescaped and outputting an escaped string. This prevents someone accidentally ToString'ing a path in its unescaped form.

@Tratcher
Copy link
Member

@khellang We didn't specify which was wrong, just that it's asymmetric. If anything I think it's the string -> PathString converter that's wrong, it should use FromUriComponent to maintain symmetry. Unfortunately that's not how we normally to use it either.

@muratg
Copy link

muratg commented Sep 7, 2016

This would be a breaking change. We'll reconsider in 2.0

@muratg muratg added this to the Backlog milestone Sep 7, 2016
@Tratcher Tratcher removed this from the Backlog milestone Jun 1, 2017
@Tratcher
Copy link
Member

Tratcher commented Jun 1, 2017

@muratg we should re-triage this if we're ever going to fix it.

@HaoK HaoK self-assigned this Jun 15, 2017
@HaoK HaoK added this to the 2.0.0 milestone Jun 15, 2017
@HaoK
Copy link
Member

HaoK commented Jun 20, 2017

12f89f6

@HaoK HaoK closed this as completed Jun 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants