Fossil

Check-in [a9c4b3c4b4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ignore a trailing "/" on the name= query parameter for /file when showing a directory listing.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a9c4b3c4b441e4e8c52e695372ab7406692e0198bd58b822ea60a56b9b36dcda
User & Date: drh 2017-03-15 19:50:24.806
Context
2017-03-15
23:31
Create two new README files under test/subdir/ for testing purposes. ... (check-in: 34d9bddf8d user: drh tags: trunk)
19:50
Ignore a trailing "/" on the name= query parameter for /file when showing a directory listing. ... (check-in: a9c4b3c4b4 user: drh tags: trunk)
19:06
Add the "[history]" link on the /dir page for subdirectories. ... (check-in: 6a01228fe1 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/info.c.
1895
1896
1897
1898
1899
1900
1901
1902



1903
1904
1905
1906
1907
1908
1909

1910
1911
1912
1913
1914
1915
1916
         "   AND mlink.fnid=filename.fnid"
         "   AND event.objid=mlink.mid"
         " ORDER BY event.mtime DESC LIMIT 1",
         zName
      );
      /* If no file called NAME exists, instead look for a directory
      ** with that name, and do a directory listing */
      if( rid==0 && db_exists(



         "SELECT 1 FROM filename"
         " WHERE name GLOB '%q/*' AND substr(name,1,length(%Q)+1)=='%q/';",
         zName, zName, zName
      ) ){
        if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
        page_tree();
        return;

      }
      /* If no file or directory called NAME: issue an error */
      if( rid==0 ){
        style_header("No such file");
        @ File '%h(zName)' does not exist in this repository.
        style_footer();
        return;







|
>
>
>
|
|
|
|
|
|
|
>







1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
         "   AND mlink.fnid=filename.fnid"
         "   AND event.objid=mlink.mid"
         " ORDER BY event.mtime DESC LIMIT 1",
         zName
      );
      /* If no file called NAME exists, instead look for a directory
      ** with that name, and do a directory listing */
      if( rid==0 ){
        int nName = (int)strlen(zName);
        if( nName && zName[nName-1]=='/' ) nName--;
        if( db_exists(
           "SELECT 1 FROM filename"
           " WHERE name GLOB '%.*q/*' AND substr(name,1,%d)=='%.*q/';",
           nName, zName, nName+1, nName, zName
        ) ){
          if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
          page_tree();
          return;
        }
      }
      /* If no file or directory called NAME: issue an error */
      if( rid==0 ){
        style_header("No such file");
        @ File '%h(zName)' does not exist in this repository.
        style_footer();
        return;