Differences From:
File
src/wikiformat.c
part of check-in
[bf428e6854]
- Now able to enter and edit and display wiki pages. Still many problems
to be resolved.
by
drh on
2007-10-06 13:13:33.
[view]
To:
File
src/wikiformat.c
part of check-in
[488afb9746]
- Enforce well-formedness constraints on wiki pagenames.
by
drh on
2007-10-06 17:10:47.
[view]
@@ -761,10 +761,12 @@
|| strncmp(zTarget, "ftp:", 4)==0
|| strncmp(zTarget, "mailto:", 7)==0
){
blob_appendf(p->pOut, zTarget);
- }else{
+ }else if( wiki_name_is_wellformed(zTarget) ){
blob_appendf(p->pOut, "%s/wiki/%T", g.zBaseURL, zTarget);
+ }else{
+ blob_appendf(p->pOut, "error");
}
}
/*
@@ -863,16 +865,17 @@
}
case TOKEN_LINK: {
char *zTarget;
char *zDisplay = 0;
- int i;
+ int i, j;
int savedState;
addMissingMarkup(p);
zTarget = &z[1];
for(i=1; z[i] && z[i]!=']'; i++){
if( z[i]=='|' && zDisplay==0 ){
zDisplay = &z[i+1];
z[i] = 0;
+ for(j=i-1; j>0 && isspace(z[j]); j--){ z[j] = 0; }
}
}
z[i] = 0;
if( zDisplay==0 ){