Fossil SCM

Fixed /json/dir to work over HTTP mode, too.

stephan 2012-03-16 17:44 trunk
Commit 857a6d9142a6b36b7ea655a208e15ca9a5eb6811
1 file changed +5 -5
+5 -5
--- src/json_dir.c
+++ src/json_dir.c
@@ -34,11 +34,11 @@
3434
3535
static char const * json_dir_path_extra(){
3636
static char const * zP = NULL;
3737
if( !zP ){
3838
zP = g.zExtra;
39
- while(zP && ('/'==*zP)){
39
+ while(zP && *zP && ('/'==*zP)){
4040
++zP;
4141
}
4242
}
4343
return zP;
4444
}
@@ -85,15 +85,15 @@
8585
zCI);
8686
return NULL;
8787
}
8888
}
8989
90
- zDX = g.isHTTP ? json_dir_path_extra() : NULL;
91
- if(!zDX || !*zDX){
92
- zDX = json_find_option_cstr2("name",NULL,"n", g.json.dispatchDepth+1);
90
+ zDX = json_find_option_cstr("name",NULL,"n");
91
+ if((!zDX || !*zDX) && !g.isHTTP){
92
+ zDX = json_command_arg(g.json.dispatchDepth+1);
9393
}
94
- zD = zDX ? fossil_strdup(zDX) : NULL;
94
+ zD = (zDX && *zDX) ? fossil_strdup(zDX) : NULL;
9595
nD = zD ? strlen(zD)+1 : 0;
9696
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
9797
9898
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
9999
pathelementFunc, 0, 0);
100100
--- src/json_dir.c
+++ src/json_dir.c
@@ -34,11 +34,11 @@
34
35 static char const * json_dir_path_extra(){
36 static char const * zP = NULL;
37 if( !zP ){
38 zP = g.zExtra;
39 while(zP && ('/'==*zP)){
40 ++zP;
41 }
42 }
43 return zP;
44 }
@@ -85,15 +85,15 @@
85 zCI);
86 return NULL;
87 }
88 }
89
90 zDX = g.isHTTP ? json_dir_path_extra() : NULL;
91 if(!zDX || !*zDX){
92 zDX = json_find_option_cstr2("name",NULL,"n", g.json.dispatchDepth+1);
93 }
94 zD = zDX ? fossil_strdup(zDX) : NULL;
95 nD = zD ? strlen(zD)+1 : 0;
96 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
97
98 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
99 pathelementFunc, 0, 0);
100
--- src/json_dir.c
+++ src/json_dir.c
@@ -34,11 +34,11 @@
34
35 static char const * json_dir_path_extra(){
36 static char const * zP = NULL;
37 if( !zP ){
38 zP = g.zExtra;
39 while(zP && *zP && ('/'==*zP)){
40 ++zP;
41 }
42 }
43 return zP;
44 }
@@ -85,15 +85,15 @@
85 zCI);
86 return NULL;
87 }
88 }
89
90 zDX = json_find_option_cstr("name",NULL,"n");
91 if((!zDX || !*zDX) && !g.isHTTP){
92 zDX = json_command_arg(g.json.dispatchDepth+1);
93 }
94 zD = (zDX && *zDX) ? fossil_strdup(zDX) : NULL;
95 nD = zD ? strlen(zD)+1 : 0;
96 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
97
98 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
99 pathelementFunc, 0, 0);
100

Keyboard Shortcuts

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