Fossil SCM

Ignore trailing / characters on the "name=" parameter to the dir URL.

drh 2011-01-26 20:46 trunk
Commit 8854d6b615d5c309b7e40b4f94d4f3de3fd5dbc5
1 file changed +2 -1
+2 -1
--- src/browse.c
+++ src/browse.c
@@ -103,11 +103,11 @@
103103
**
104104
** name=PATH Directory to display. Required.
105105
** ci=LABEL Show only files in this check-in. Optional.
106106
*/
107107
void page_dir(void){
108
- const char *zD = P("name");
108
+ char *zD = fossil_strdup(P("name"));
109109
int nD = zD ? strlen(zD)+1 : 0;
110110
int mxLen;
111111
int nCol, nRow;
112112
int cnt, i;
113113
char *zPrefix;
@@ -119,10 +119,11 @@
119119
Manifest *pM = 0;
120120
const char *zSubdirLink;
121121
122122
login_check_credentials();
123123
if( !g.okHistory ){ login_needed(); return; }
124
+ while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
124125
style_header("File List");
125126
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
126127
pathelementFunc, 0, 0);
127128
128129
/* If the name= parameter is an empty string, make it a NULL pointer */
129130
--- src/browse.c
+++ src/browse.c
@@ -103,11 +103,11 @@
103 **
104 ** name=PATH Directory to display. Required.
105 ** ci=LABEL Show only files in this check-in. Optional.
106 */
107 void page_dir(void){
108 const char *zD = P("name");
109 int nD = zD ? strlen(zD)+1 : 0;
110 int mxLen;
111 int nCol, nRow;
112 int cnt, i;
113 char *zPrefix;
@@ -119,10 +119,11 @@
119 Manifest *pM = 0;
120 const char *zSubdirLink;
121
122 login_check_credentials();
123 if( !g.okHistory ){ login_needed(); return; }
 
124 style_header("File List");
125 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
126 pathelementFunc, 0, 0);
127
128 /* If the name= parameter is an empty string, make it a NULL pointer */
129
--- src/browse.c
+++ src/browse.c
@@ -103,11 +103,11 @@
103 **
104 ** name=PATH Directory to display. Required.
105 ** ci=LABEL Show only files in this check-in. Optional.
106 */
107 void page_dir(void){
108 char *zD = fossil_strdup(P("name"));
109 int nD = zD ? strlen(zD)+1 : 0;
110 int mxLen;
111 int nCol, nRow;
112 int cnt, i;
113 char *zPrefix;
@@ -119,10 +119,11 @@
119 Manifest *pM = 0;
120 const char *zSubdirLink;
121
122 login_check_credentials();
123 if( !g.okHistory ){ login_needed(); return; }
124 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
125 style_header("File List");
126 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
127 pathelementFunc, 0, 0);
128
129 /* If the name= parameter is an empty string, make it a NULL pointer */
130

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button