<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>21210</bug_id>
          
          <creation_ts>2013-03-07 11:02:12 +0000</creation_ts>
          <short_desc>Changes to make &quot;.&quot; and &quot;..&quot; parse properly</short_desc>
          <delta_ts>2013-03-07 14:27:03 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>URL</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Peter Occil">poccil</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>mike</cc>
          
          <qa_contact>sideshowbarker+urlspec</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84072</commentid>
    <comment_count>0</comment_count>
    <who name="Peter Occil">poccil</who>
    <bug_when>2013-03-07 11:02:12 +0000</bug_when>
    <thetext>http://url.spec.whatwg.org/#relative-path-start-state

[[
relative path start state
1. If c is &quot;\&quot;, parse error.

2. Set state to relative path state and if c is neither &quot;/&quot; nor &quot;\&quot;, decrease pointer by one.

relative path state
1. If either c is one of EOF code point, &quot;/&quot;, and &quot;\&quot;, or state override is not given and c is one of &quot;?&quot; and &quot;#&quot;, run these substeps:

  1. If buffer is &quot;..&quot; and c is one of EOF code point, &quot;/&quot;, and &quot;\&quot;, pop url&apos;s path, if non-empty, and then append the empty string to it.

  2. Otherwise, if buffer is &quot;..&quot;, pop url&apos;s path, if non-empty.

  3. Otherwise, if buffer is &quot;.&quot; and c is one of EOF code point, &quot;/&quot;, and &quot;\&quot;, append an empty string to url&apos;s path.

  4. Otherwise, if buffer is not &quot;.&quot;, run these subsubsteps:
]]

I suggest the following changes to that text:

-----------------------
relative path start state

2. Set state to relative path state and decrease pointer by one.
-----
relative path state

1. [...]

   1. If buffer is &quot;..&quot;, pop url&apos;s path, if non-empty, then if c 
       is neither &quot;/&quot; nor &quot;\&quot;, append the empty string to url&apos;s path.

   2.  Otherwise, if buffer is &quot;.&quot; and c is neither &quot;/&quot;, nor &quot;\&quot;, append an 
        empty string to url&apos;s path.

   3.  Otherwise, if buffer is neither &quot;..&quot; nor &quot;.&quot;, run these subsubsteps [...]
-----------------------

With these changes, I believe the following test cases will pass:
   
/x/w/../y -&gt; /x/y
/x/w/.. -&gt; /x/
/x/w/..#z -&gt; /x/#z

////../.. -&gt; //
/x/x/x/../.. -&gt; /x/

/x/../y -&gt; /y
/x/.. -&gt; /
/x/..#z -&gt; /#z

/../y -&gt; /y
/.. -&gt; /
/..#z -&gt; /#z

/x/./y -&gt; /x/y
/x/. -&gt; /x/
/x/.#z -&gt; /x/#z
/./y -&gt; /y
/. -&gt; /
/.#z -&gt; /#z</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84075</commentid>
    <comment_count>1</comment_count>
    <who name="Peter Occil">poccil</who>
    <bug_when>2013-03-07 13:08:24 +0000</bug_when>
    <thetext>I take back the changes to the relative path start state. The rest of my message still stands.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84078</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-03-07 14:27:03 +0000</bug_when>
    <thetext>So the \ and / should&apos;ve been ? and #. But your proposed text is shorter so I&apos;ve gone with that.

Also added the missing parse error for \.

I did not add the additional check for &quot;..&quot; as that&apos;s redundant with the usage of otherwise.

https://github.com/whatwg/url/commit/b3fd683a3907e379ffc1469beee79d8e469b61a8</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>