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.
Commit
fd10cdbaf8c759127add463eff960e77ed9c9036
Parent
cb6804a2e3f7ca4…
3 files changed
+1
+5
-5
+4
-4
+1
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -370,10 +370,11 @@ | ||
| 370 | 370 | for(i=0; zName[i] && zName[i]!='/'; i++){} |
| 371 | 371 | if( zName[i]==0 || i>UUID_SIZE ){ |
| 372 | 372 | zName = "index.html"; |
| 373 | 373 | goto doc_not_found; |
| 374 | 374 | } |
| 375 | + g.zPath = mprintf("%s/%s", g.zPath, zName); | |
| 375 | 376 | memcpy(zBaseline, zName, i); |
| 376 | 377 | zBaseline[i] = 0; |
| 377 | 378 | zName += i; |
| 378 | 379 | while( zName[0]=='/' ){ zName++; } |
| 379 | 380 | if( !file_is_simple_pathname(zName) ){ |
| 380 | 381 |
| --- 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 @@ | ||
| 62 | 62 | |
| 63 | 63 | /* Make sure the header contains <base href="...">. Issue a warning |
| 64 | 64 | ** if it does not. */ |
| 65 | 65 | if( !cgi_header_contains("<base href=") ){ |
| 66 | 66 | @ <p class="generalError"><b>Configuration Error:</b> Please add |
| 67 | - @ <tt><base href="$baseurl/"></tt> after <tt><head></tt> | |
| 68 | - @ in the <a href="setup_header">HTML header</a>!</p> | |
| 67 | + @ <tt><base href="$baseurl/$current_page"></tt> after | |
| 68 | + @ <tt><head></tt> in the <a href="setup_header">HTML header</a>!</p> | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | @ <table border="0" cellspacing="7"> |
| 72 | 72 | setup_menu_entry("Users", "setup_ulist", |
| 73 | 73 | "Grant privileges to individual users."); |
| @@ -1364,11 +1364,11 @@ | ||
| 1364 | 1364 | char *zHead = strstr(z, "<head>"); |
| 1365 | 1365 | if( strstr(z, "<base href=")==0 && zHead!=0 ){ |
| 1366 | 1366 | char *zNew; |
| 1367 | 1367 | char *zTail = &zHead[6]; |
| 1368 | 1368 | 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", | |
| 1370 | 1370 | zHead+6-z, z, zTail); |
| 1371 | 1371 | cgi_replace_parameter("header", zNew); |
| 1372 | 1372 | db_set("header", zNew, 0); |
| 1373 | 1373 | } |
| 1374 | 1374 | } |
| @@ -1378,12 +1378,12 @@ | ||
| 1378 | 1378 | |
| 1379 | 1379 | /* Make sure the header contains <base href="...">. Issue a warning |
| 1380 | 1380 | ** if it does not. */ |
| 1381 | 1381 | if( !cgi_header_contains("<base href=") ){ |
| 1382 | 1382 | @ <p class="generalError">Please add |
| 1383 | - @ <tt><base href="$baseurl/"></tt> after <tt><head></tt> | |
| 1384 | - @ in the header! | |
| 1383 | + @ <tt><base href="$baseurl/$current_page"></tt> after | |
| 1384 | + @ <tt><head></tt> in the header! | |
| 1385 | 1385 | @ <input type="submit" name="fixbase" value="Add <base> Now"></p> |
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | 1388 | login_insert_csrf_secret(); |
| 1389 | 1389 | @ <p>Edit HTML text with embedded TH1 (a TCL dialect) that will be used to |
| 1390 | 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><base href="$baseurl/"></tt> after <tt><head></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><base href="$baseurl/"></tt> after <tt><head></tt> |
| 1384 | @ in the header! |
| 1385 | @ <input type="submit" name="fixbase" value="Add <base> 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><base href="$baseurl/$current_page"></tt> after |
| 68 | @ <tt><head></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><base href="$baseurl/$current_page"></tt> after |
| 1384 | @ <tt><head></tt> in the header! |
| 1385 | @ <input type="submit" name="fixbase" value="Add <base> 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 @@ | ||
| 156 | 156 | @ text-align: right; |
| 157 | 157 | @ padding: 0.2ex 2ex; |
| 158 | 158 | @ }'); |
| 159 | 159 | @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html> |
| 160 | 160 | @ <head> |
| 161 | -@ <base href="$baseurl/" /> | |
| 161 | +@ <base href="$baseurl/$current_page" /> | |
| 162 | 162 | @ <title>$<project_name>: $<title></title> |
| 163 | 163 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" |
| 164 | 164 | @ href="$home/timeline.rss"> |
| 165 | 165 | @ <link rel="stylesheet" href="$home/style.css?blackwhite" type="text/css" |
| 166 | 166 | @ media="screen"> |
| @@ -359,11 +359,11 @@ | ||
| 359 | 359 | @ text-align: right; |
| 360 | 360 | @ padding: 0.2ex 2ex; |
| 361 | 361 | @ }'); |
| 362 | 362 | @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html> |
| 363 | 363 | @ <head> |
| 364 | -@ <base href="$baseurl/" /> | |
| 364 | +@ <base href="$baseurl/$current_page" /> | |
| 365 | 365 | @ <title>$<project_name>: $<title></title> |
| 366 | 366 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" |
| 367 | 367 | @ href="$home/timeline.rss"> |
| 368 | 368 | @ <link rel="stylesheet" href="$home/style.css?tan" type="text/css" |
| 369 | 369 | @ media="screen"> |
| @@ -596,11 +596,11 @@ | ||
| 596 | 596 | @ text-align: right; |
| 597 | 597 | @ padding: 0.2ex 2ex; |
| 598 | 598 | @ }'); |
| 599 | 599 | @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html> |
| 600 | 600 | @ <head> |
| 601 | -@ <base href="$baseurl/" /> | |
| 601 | +@ <base href="$baseurl/$current_page" /> | |
| 602 | 602 | @ <title>$<project_name>: $<title></title> |
| 603 | 603 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" |
| 604 | 604 | @ href="$home/timeline.rss"> |
| 605 | 605 | @ <link rel="stylesheet" href="$home/style.css?black2" type="text/css" |
| 606 | 606 | @ media="screen"> |
| @@ -895,11 +895,11 @@ | ||
| 895 | 895 | @ textarea { |
| 896 | 896 | @ font-size: 1em; |
| 897 | 897 | @ }'); |
| 898 | 898 | @ REPLACE INTO config(name,mtime,value) VALUES('header',now(),'<html> |
| 899 | 899 | @ <head> |
| 900 | -@ <base href="$baseurl/" /> | |
| 900 | +@ <base href="$baseurl/$current_page" /> | |
| 901 | 901 | @ <title>$<project_name>: $<title></title> |
| 902 | 902 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" |
| 903 | 903 | @ href="$home/timeline.rss"> |
| 904 | 904 | @ <link rel="stylesheet" href="$home/style.css?black2" type="text/css" |
| 905 | 905 | @ media="screen"> |
| 906 | 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/" /> |
| 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 |