Fossil SCM
Ignore trailing / characters on the "name=" parameter to the dir URL.
Commit
8854d6b615d5c309b7e40b4f94d4f3de3fd5dbc5
Parent
42f6e8bed71cf39…
1 file changed
+2
-1
+2
-1
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -103,11 +103,11 @@ | ||
| 103 | 103 | ** |
| 104 | 104 | ** name=PATH Directory to display. Required. |
| 105 | 105 | ** ci=LABEL Show only files in this check-in. Optional. |
| 106 | 106 | */ |
| 107 | 107 | void page_dir(void){ |
| 108 | - const char *zD = P("name"); | |
| 108 | + char *zD = fossil_strdup(P("name")); | |
| 109 | 109 | int nD = zD ? strlen(zD)+1 : 0; |
| 110 | 110 | int mxLen; |
| 111 | 111 | int nCol, nRow; |
| 112 | 112 | int cnt, i; |
| 113 | 113 | char *zPrefix; |
| @@ -119,10 +119,11 @@ | ||
| 119 | 119 | Manifest *pM = 0; |
| 120 | 120 | const char *zSubdirLink; |
| 121 | 121 | |
| 122 | 122 | login_check_credentials(); |
| 123 | 123 | if( !g.okHistory ){ login_needed(); return; } |
| 124 | + while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } | |
| 124 | 125 | style_header("File List"); |
| 125 | 126 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 126 | 127 | pathelementFunc, 0, 0); |
| 127 | 128 | |
| 128 | 129 | /* If the name= parameter is an empty string, make it a NULL pointer */ |
| 129 | 130 |
| --- 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 |