Fossil SCM

Fixes to the <base> addition to the HTML header so that it works correctly with the "doc" webpage. Href is now $baseurl/$current_page.

drh 2012-08-13 12:30 UTC wysiwyg
Commit fd10cdbaf8c759127add463eff960e77ed9c9036
3 files changed +1 +5 -5 +4 -4
+1
--- src/doc.c
+++ src/doc.c
@@ -370,10 +370,11 @@
370370
for(i=0; zName[i] && zName[i]!='/'; i++){}
371371
if( zName[i]==0 || i>UUID_SIZE ){
372372
zName = "index.html";
373373
goto doc_not_found;
374374
}
375
+ g.zPath = mprintf("%s/%s", g.zPath, zName);
375376
memcpy(zBaseline, zName, i);
376377
zBaseline[i] = 0;
377378
zName += i;
378379
while( zName[0]=='/' ){ zName++; }
379380
if( !file_is_simple_pathname(zName) ){
380381
--- src/doc.c
+++ src/doc.c
@@ -370,10 +370,11 @@
370 for(i=0; zName[i] && zName[i]!='/'; i++){}
371 if( zName[i]==0 || i>UUID_SIZE ){
372 zName = "index.html";
373 goto doc_not_found;
374 }
 
375 memcpy(zBaseline, zName, i);
376 zBaseline[i] = 0;
377 zName += i;
378 while( zName[0]=='/' ){ zName++; }
379 if( !file_is_simple_pathname(zName) ){
380
--- src/doc.c
+++ src/doc.c
@@ -370,10 +370,11 @@
370 for(i=0; zName[i] && zName[i]!='/'; i++){}
371 if( zName[i]==0 || i>UUID_SIZE ){
372 zName = "index.html";
373 goto doc_not_found;
374 }
375 g.zPath = mprintf("%s/%s", g.zPath, zName);
376 memcpy(zBaseline, zName, i);
377 zBaseline[i] = 0;
378 zName += i;
379 while( zName[0]=='/' ){ zName++; }
380 if( !file_is_simple_pathname(zName) ){
381
+5 -5
--- src/setup.c
+++ src/setup.c
@@ -62,12 +62,12 @@
6262
6363
/* Make sure the header contains <base href="...">. Issue a warning
6464
** if it does not. */
6565
if( !cgi_header_contains("<base href=") ){
6666
@ <p class="generalError"><b>Configuration Error:</b> Please add
67
- @ <tt>&lt;base href="$baseurl/"&gt</tt> after <tt>&lt;head&gt;</tt>
68
- @ in the <a href="setup_header">HTML header</a>!</p>
67
+ @ <tt>&lt;base href="$baseurl/$current_page"&gt</tt> after
68
+ @ <tt>&lt;head&gt;</tt> in the <a href="setup_header">HTML header</a>!</p>
6969
}
7070
7171
@ <table border="0" cellspacing="7">
7272
setup_menu_entry("Users", "setup_ulist",
7373
"Grant privileges to individual users.");
@@ -1364,11 +1364,11 @@
13641364
char *zHead = strstr(z, "<head>");
13651365
if( strstr(z, "<base href=")==0 && zHead!=0 ){
13661366
char *zNew;
13671367
char *zTail = &zHead[6];
13681368
while( fossil_isspace(zTail[0]) ) zTail++;
1369
- zNew = mprintf("%.*s\n<base href=\"$baseurl/\" />\n%s",
1369
+ zNew = mprintf("%.*s\n<base href=\"$baseurl/$current_page\" />\n%s",
13701370
zHead+6-z, z, zTail);
13711371
cgi_replace_parameter("header", zNew);
13721372
db_set("header", zNew, 0);
13731373
}
13741374
}
@@ -1378,12 +1378,12 @@
13781378
13791379
/* Make sure the header contains <base href="...">. Issue a warning
13801380
** if it does not. */
13811381
if( !cgi_header_contains("<base href=") ){
13821382
@ <p class="generalError">Please add
1383
- @ <tt>&lt;base href="$baseurl/"&gt</tt> after <tt>&lt;head&gt;</tt>
1384
- @ in the header!
1383
+ @ <tt>&lt;base href="$baseurl/$current_page"&gt</tt> after
1384
+ @ <tt>&lt;head&gt;</tt> in the header!
13851385
@ <input type="submit" name="fixbase" value="Add &lt;base&gt; Now"></p>
13861386
}
13871387
13881388
login_insert_csrf_secret();
13891389
@ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to
13901390
--- src/setup.c
+++ src/setup.c
@@ -62,12 +62,12 @@
62
63 /* Make sure the header contains <base href="...">. Issue a warning
64 ** if it does not. */
65 if( !cgi_header_contains("<base href=") ){
66 @ <p class="generalError"><b>Configuration Error:</b> Please add
67 @ <tt>&lt;base href="$baseurl/"&gt</tt> after <tt>&lt;head&gt;</tt>
68 @ in the <a href="setup_header">HTML header</a>!</p>
69 }
70
71 @ <table border="0" cellspacing="7">
72 setup_menu_entry("Users", "setup_ulist",
73 "Grant privileges to individual users.");
@@ -1364,11 +1364,11 @@
1364 char *zHead = strstr(z, "<head>");
1365 if( strstr(z, "<base href=")==0 && zHead!=0 ){
1366 char *zNew;
1367 char *zTail = &zHead[6];
1368 while( fossil_isspace(zTail[0]) ) zTail++;
1369 zNew = mprintf("%.*s\n<base href=\"$baseurl/\" />\n%s",
1370 zHead+6-z, z, zTail);
1371 cgi_replace_parameter("header", zNew);
1372 db_set("header", zNew, 0);
1373 }
1374 }
@@ -1378,12 +1378,12 @@
1378
1379 /* Make sure the header contains <base href="...">. Issue a warning
1380 ** if it does not. */
1381 if( !cgi_header_contains("<base href=") ){
1382 @ <p class="generalError">Please add
1383 @ <tt>&lt;base href="$baseurl/"&gt</tt> after <tt>&lt;head&gt;</tt>
1384 @ in the header!
1385 @ <input type="submit" name="fixbase" value="Add &lt;base&gt; Now"></p>
1386 }
1387
1388 login_insert_csrf_secret();
1389 @ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to
1390
--- src/setup.c
+++ src/setup.c
@@ -62,12 +62,12 @@
62
63 /* Make sure the header contains <base href="...">. Issue a warning
64 ** if it does not. */
65 if( !cgi_header_contains("<base href=") ){
66 @ <p class="generalError"><b>Configuration Error:</b> Please add
67 @ <tt>&lt;base href="$baseurl/$current_page"&gt</tt> after
68 @ <tt>&lt;head&gt;</tt> in the <a href="setup_header">HTML header</a>!</p>
69 }
70
71 @ <table border="0" cellspacing="7">
72 setup_menu_entry("Users", "setup_ulist",
73 "Grant privileges to individual users.");
@@ -1364,11 +1364,11 @@
1364 char *zHead = strstr(z, "<head>");
1365 if( strstr(z, "<base href=")==0 && zHead!=0 ){
1366 char *zNew;
1367 char *zTail = &zHead[6];
1368 while( fossil_isspace(zTail[0]) ) zTail++;
1369 zNew = mprintf("%.*s\n<base href=\"$baseurl/$current_page\" />\n%s",
1370 zHead+6-z, z, zTail);
1371 cgi_replace_parameter("header", zNew);
1372 db_set("header", zNew, 0);
1373 }
1374 }
@@ -1378,12 +1378,12 @@
1378
1379 /* Make sure the header contains <base href="...">. Issue a warning
1380 ** if it does not. */
1381 if( !cgi_header_contains("<base href=") ){
1382 @ <p class="generalError">Please add
1383 @ <tt>&lt;base href="$baseurl/$current_page"&gt</tt> after
1384 @ <tt>&lt;head&gt;</tt> in the header!
1385 @ <input type="submit" name="fixbase" value="Add &lt;base&gt; Now"></p>
1386 }
1387
1388 login_insert_csrf_secret();
1389 @ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to
1390
+4 -4
--- src/skins.c
+++ src/skins.c
@@ -156,11 +156,11 @@
156156
@ text-align: right;
157157
@ padding: 0.2ex 2ex;
158158
@ }');
159159
@ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
160160
@ <head>
161
-@ <base href="$baseurl/" />
161
+@ <base href="$baseurl/$current_page" />
162162
@ <title>$<project_name>: $<title></title>
163163
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
164164
@ href="$home/timeline.rss">
165165
@ <link rel="stylesheet" href="$home/style.css?blackwhite" type="text/css"
166166
@ media="screen">
@@ -359,11 +359,11 @@
359359
@ text-align: right;
360360
@ padding: 0.2ex 2ex;
361361
@ }');
362362
@ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
363363
@ <head>
364
-@ <base href="$baseurl/" />
364
+@ <base href="$baseurl/$current_page" />
365365
@ <title>$<project_name>: $<title></title>
366366
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
367367
@ href="$home/timeline.rss">
368368
@ <link rel="stylesheet" href="$home/style.css?tan" type="text/css"
369369
@ media="screen">
@@ -596,11 +596,11 @@
596596
@ text-align: right;
597597
@ padding: 0.2ex 2ex;
598598
@ }');
599599
@ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
600600
@ <head>
601
-@ <base href="$baseurl/" />
601
+@ <base href="$baseurl/$current_page" />
602602
@ <title>$<project_name>: $<title></title>
603603
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
604604
@ href="$home/timeline.rss">
605605
@ <link rel="stylesheet" href="$home/style.css?black2" type="text/css"
606606
@ media="screen">
@@ -895,11 +895,11 @@
895895
@ textarea {
896896
@ font-size: 1em;
897897
@ }');
898898
@ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
899899
@ <head>
900
-@ <base href="$baseurl/" />
900
+@ <base href="$baseurl/$current_page" />
901901
@ <title>$<project_name>: $<title></title>
902902
@ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
903903
@ href="$home/timeline.rss">
904904
@ <link rel="stylesheet" href="$home/style.css?black2" type="text/css"
905905
@ media="screen">
906906
--- src/skins.c
+++ src/skins.c
@@ -156,11 +156,11 @@
156 @ text-align: right;
157 @ padding: 0.2ex 2ex;
158 @ }');
159 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
160 @ <head>
161 @ <base href="$baseurl/" />
162 @ <title>$<project_name>: $<title></title>
163 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
164 @ href="$home/timeline.rss">
165 @ <link rel="stylesheet" href="$home/style.css?blackwhite" type="text/css"
166 @ media="screen">
@@ -359,11 +359,11 @@
359 @ text-align: right;
360 @ padding: 0.2ex 2ex;
361 @ }');
362 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
363 @ <head>
364 @ <base href="$baseurl/" />
365 @ <title>$<project_name>: $<title></title>
366 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
367 @ href="$home/timeline.rss">
368 @ <link rel="stylesheet" href="$home/style.css?tan" type="text/css"
369 @ media="screen">
@@ -596,11 +596,11 @@
596 @ text-align: right;
597 @ padding: 0.2ex 2ex;
598 @ }');
599 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
600 @ <head>
601 @ <base href="$baseurl/" />
602 @ <title>$<project_name>: $<title></title>
603 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
604 @ href="$home/timeline.rss">
605 @ <link rel="stylesheet" href="$home/style.css?black2" type="text/css"
606 @ media="screen">
@@ -895,11 +895,11 @@
895 @ textarea {
896 @ font-size: 1em;
897 @ }');
898 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
899 @ <head>
900 @ <base href="$baseurl/" />
901 @ <title>$<project_name>: $<title></title>
902 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
903 @ href="$home/timeline.rss">
904 @ <link rel="stylesheet" href="$home/style.css?black2" type="text/css"
905 @ media="screen">
906
--- src/skins.c
+++ src/skins.c
@@ -156,11 +156,11 @@
156 @ text-align: right;
157 @ padding: 0.2ex 2ex;
158 @ }');
159 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
160 @ <head>
161 @ <base href="$baseurl/$current_page" />
162 @ <title>$<project_name>: $<title></title>
163 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
164 @ href="$home/timeline.rss">
165 @ <link rel="stylesheet" href="$home/style.css?blackwhite" type="text/css"
166 @ media="screen">
@@ -359,11 +359,11 @@
359 @ text-align: right;
360 @ padding: 0.2ex 2ex;
361 @ }');
362 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
363 @ <head>
364 @ <base href="$baseurl/$current_page" />
365 @ <title>$<project_name>: $<title></title>
366 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
367 @ href="$home/timeline.rss">
368 @ <link rel="stylesheet" href="$home/style.css?tan" type="text/css"
369 @ media="screen">
@@ -596,11 +596,11 @@
596 @ text-align: right;
597 @ padding: 0.2ex 2ex;
598 @ }');
599 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
600 @ <head>
601 @ <base href="$baseurl/$current_page" />
602 @ <title>$<project_name>: $<title></title>
603 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
604 @ href="$home/timeline.rss">
605 @ <link rel="stylesheet" href="$home/style.css?black2" type="text/css"
606 @ media="screen">
@@ -895,11 +895,11 @@
895 @ textarea {
896 @ font-size: 1em;
897 @ }');
898 @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html>
899 @ <head>
900 @ <base href="$baseurl/$current_page" />
901 @ <title>$<project_name>: $<title></title>
902 @ <link rel="alternate" type="application/rss+xml" title="RSS Feed"
903 @ href="$home/timeline.rss">
904 @ <link rel="stylesheet" href="$home/style.css?black2" type="text/css"
905 @ media="screen">
906

Keyboard Shortcuts

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