zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #16219
Re: [Merge] lp:~zorba-coders/zorba/bug1073091 into lp:zorba
Review: Needs Fixing
Unless I'm mistaken, there's no requirement that a fragment identifier must follow a forward-slash. The following is a valid URI with a fragment identifier:
http://www.example.com/foobar#zot
So the check for (lNormUri.at(found-1) == '/') is incorrect. Also I think it might cause a crash if the URI is the string "#" (which is probably not valid anyway, but still we shouldn't crash).
More generally: I just spent a while reading RFC 3986 to see whether a simple character-search for '#' was sufficient to identify a fragment, when it occurred to me that I shouldn't be trying to answer that question manually. I think a better solution here would be to construct a zorba::URI object (src/zorbatypes/URI.h) from lNormUri and then call get_encoded_fragment() on it to see if there is any fragment. I don't like introducing that much overhead to perform this function, but parsing URIs is tricky and IMHO it makes sense to consolidate all of that functionality in a single place, namely the URI class.
--
https://code.launchpad.net/~zorba-coders/zorba/bug1073091/+merge/139346
Your team Zorba Coders is subscribed to branch lp:zorba.
Follow ups
References