Fossil SCM
/mimetype_list: only show the custom mimetypes table if any are set. Add a link to the mimetypes setting help to the top of the page. Expanded the setting's help text.
Commit
14d1b7a9770c87fe26151b607754620d2c03024800faf8d96c3c14487de1d4c4
Parent
baf119337bdc675…
2 files changed
+4
-2
+18
-15
M
src/db.c
+4
-2
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -3451,12 +3451,14 @@ | ||
| 3451 | 3451 | ** SETTING: max-upload width=25 default=250000 |
| 3452 | 3452 | ** A limit on the size of uplink HTTP requests. |
| 3453 | 3453 | */ |
| 3454 | 3454 | /* |
| 3455 | 3455 | ** SETTING: mimetypes width=40 versionable block-text |
| 3456 | -** A list of file extension-to-mimetype mappings, one per line. | |
| 3457 | -** Note that extensions are compared case-insensitively. | |
| 3456 | +** A list of file extension-to-mimetype mappings, one per line. e.g. | |
| 3457 | +** "foo application/x-foo". File extensions are compared | |
| 3458 | +** case-insensitively in the order listed in this setting. A leading | |
| 3459 | +** '.' on file extensions is permitted but not required. | |
| 3458 | 3460 | */ |
| 3459 | 3461 | /* |
| 3460 | 3462 | ** SETTING: mtime-changes boolean default=on |
| 3461 | 3463 | ** Use file modification times (mtimes) to detect when |
| 3462 | 3464 | ** files have been modified. If disabled, all managed files |
| 3463 | 3465 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -3451,12 +3451,14 @@ | |
| 3451 | ** SETTING: max-upload width=25 default=250000 |
| 3452 | ** A limit on the size of uplink HTTP requests. |
| 3453 | */ |
| 3454 | /* |
| 3455 | ** SETTING: mimetypes width=40 versionable block-text |
| 3456 | ** A list of file extension-to-mimetype mappings, one per line. |
| 3457 | ** Note that extensions are compared case-insensitively. |
| 3458 | */ |
| 3459 | /* |
| 3460 | ** SETTING: mtime-changes boolean default=on |
| 3461 | ** Use file modification times (mtimes) to detect when |
| 3462 | ** files have been modified. If disabled, all managed files |
| 3463 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -3451,12 +3451,14 @@ | |
| 3451 | ** SETTING: max-upload width=25 default=250000 |
| 3452 | ** A limit on the size of uplink HTTP requests. |
| 3453 | */ |
| 3454 | /* |
| 3455 | ** SETTING: mimetypes width=40 versionable block-text |
| 3456 | ** A list of file extension-to-mimetype mappings, one per line. e.g. |
| 3457 | ** "foo application/x-foo". File extensions are compared |
| 3458 | ** case-insensitively in the order listed in this setting. A leading |
| 3459 | ** '.' on file extensions is permitted but not required. |
| 3460 | */ |
| 3461 | /* |
| 3462 | ** SETTING: mtime-changes boolean default=on |
| 3463 | ** Use file modification times (mtimes) to detect when |
| 3464 | ** files have been modified. If disabled, all managed files |
| 3465 |
+18
-15
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -478,28 +478,29 @@ | ||
| 478 | 478 | */ |
| 479 | 479 | void mimetype_list_page(void){ |
| 480 | 480 | int i; |
| 481 | 481 | char *zCustomList = 0; /* value of the mimetypes setting */ |
| 482 | 482 | int nCustomEntries = 0; /* number of entries in the mimetypes |
| 483 | - setting */ | |
| 483 | + ** setting */ | |
| 484 | 484 | mimetype_verify(); |
| 485 | 485 | style_header("Mimetype List"); |
| 486 | 486 | @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename |
| 487 | 487 | @ suffixes and the following tables to guess at the appropriate mimetype |
| 488 | - @ for each document.</p> | |
| 489 | - @ <h1>Repository-specific mimetypes</h1> | |
| 490 | - @ <p>The following extension-to-mimetype mappings are defined via | |
| 491 | - @ the <a href="%R/help?cmd=mimetypes">mimetypes setting</a>.</p> | |
| 492 | - @ <table class='sortable mimetypetable' border=1 cellpadding=0 \ | |
| 493 | - @ data-column-types='tt' data-init-sort='0'> | |
| 494 | - @ <thead> | |
| 495 | - @ <tr><th>Suffix<th>Mimetype | |
| 496 | - @ </thead> | |
| 497 | - @ <tbody> | |
| 488 | + @ for each document. Mimetypes may be customized and overridden using | |
| 489 | + @ <a href="%R/help?cmd=mimetypes">the mimetypes config setting</a>.</p> | |
| 498 | 490 | zCustomList = db_get("mimetypes",0); |
| 499 | 491 | if( zCustomList!=0 ){ |
| 500 | 492 | Blob list, entry, key, val; |
| 493 | + @ <h1>Repository-specific mimetypes</h1> | |
| 494 | + @ <p>The following extension-to-mimetype mappings are defined via | |
| 495 | + @ the <a href="%R/help?cmd=mimetypes">mimetypes setting</a>.</p> | |
| 496 | + @ <table class='sortable mimetypetable' border=1 cellpadding=0 \ | |
| 497 | + @ data-column-types='tt' data-init-sort='0'> | |
| 498 | + @ <thead> | |
| 499 | + @ <tr><th>Suffix<th>Mimetype | |
| 500 | + @ </thead> | |
| 501 | + @ <tbody> | |
| 501 | 502 | blob_set(&list, zCustomList); |
| 502 | 503 | while( blob_line(&list, &entry)>0 ){ |
| 503 | 504 | const char *zKey; |
| 504 | 505 | if( blob_token(&entry, &key)==0 ) continue; |
| 505 | 506 | if( blob_token(&entry, &val)==0 ) continue; |
| @@ -507,15 +508,17 @@ | ||
| 507 | 508 | if( zKey[0]=='.' ) zKey++; |
| 508 | 509 | @ <tr><td>%h(zKey)<td>%h(blob_str(&val))</tr> |
| 509 | 510 | nCustomEntries++; |
| 510 | 511 | } |
| 511 | 512 | fossil_free(zCustomList); |
| 513 | + if( nCustomEntries==0 ){ | |
| 514 | + /* This can happen if the option is set to an empty/space-only | |
| 515 | + ** value. */ | |
| 516 | + @ <tr><td colspan="2"><em>none</em></tr> | |
| 517 | + } | |
| 518 | + @ </tbody></table> | |
| 512 | 519 | } |
| 513 | - if( nCustomEntries==0 ){ | |
| 514 | - @ <tr><td colspan="2"><em>none</em></tr> | |
| 515 | - } | |
| 516 | - @ </tbody></table> | |
| 517 | 520 | @ <h1>Default built-in mimetypes</h1> |
| 518 | 521 | if(nCustomEntries>0){ |
| 519 | 522 | @ <p>Entries starting with an exclamation mark <em><strong>!</strong></em> |
| 520 | 523 | @ are overwritten by repository-specific settings.</p> |
| 521 | 524 | } |
| 522 | 525 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -478,28 +478,29 @@ | |
| 478 | */ |
| 479 | void mimetype_list_page(void){ |
| 480 | int i; |
| 481 | char *zCustomList = 0; /* value of the mimetypes setting */ |
| 482 | int nCustomEntries = 0; /* number of entries in the mimetypes |
| 483 | setting */ |
| 484 | mimetype_verify(); |
| 485 | style_header("Mimetype List"); |
| 486 | @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename |
| 487 | @ suffixes and the following tables to guess at the appropriate mimetype |
| 488 | @ for each document.</p> |
| 489 | @ <h1>Repository-specific mimetypes</h1> |
| 490 | @ <p>The following extension-to-mimetype mappings are defined via |
| 491 | @ the <a href="%R/help?cmd=mimetypes">mimetypes setting</a>.</p> |
| 492 | @ <table class='sortable mimetypetable' border=1 cellpadding=0 \ |
| 493 | @ data-column-types='tt' data-init-sort='0'> |
| 494 | @ <thead> |
| 495 | @ <tr><th>Suffix<th>Mimetype |
| 496 | @ </thead> |
| 497 | @ <tbody> |
| 498 | zCustomList = db_get("mimetypes",0); |
| 499 | if( zCustomList!=0 ){ |
| 500 | Blob list, entry, key, val; |
| 501 | blob_set(&list, zCustomList); |
| 502 | while( blob_line(&list, &entry)>0 ){ |
| 503 | const char *zKey; |
| 504 | if( blob_token(&entry, &key)==0 ) continue; |
| 505 | if( blob_token(&entry, &val)==0 ) continue; |
| @@ -507,15 +508,17 @@ | |
| 507 | if( zKey[0]=='.' ) zKey++; |
| 508 | @ <tr><td>%h(zKey)<td>%h(blob_str(&val))</tr> |
| 509 | nCustomEntries++; |
| 510 | } |
| 511 | fossil_free(zCustomList); |
| 512 | } |
| 513 | if( nCustomEntries==0 ){ |
| 514 | @ <tr><td colspan="2"><em>none</em></tr> |
| 515 | } |
| 516 | @ </tbody></table> |
| 517 | @ <h1>Default built-in mimetypes</h1> |
| 518 | if(nCustomEntries>0){ |
| 519 | @ <p>Entries starting with an exclamation mark <em><strong>!</strong></em> |
| 520 | @ are overwritten by repository-specific settings.</p> |
| 521 | } |
| 522 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -478,28 +478,29 @@ | |
| 478 | */ |
| 479 | void mimetype_list_page(void){ |
| 480 | int i; |
| 481 | char *zCustomList = 0; /* value of the mimetypes setting */ |
| 482 | int nCustomEntries = 0; /* number of entries in the mimetypes |
| 483 | ** setting */ |
| 484 | mimetype_verify(); |
| 485 | style_header("Mimetype List"); |
| 486 | @ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename |
| 487 | @ suffixes and the following tables to guess at the appropriate mimetype |
| 488 | @ for each document. Mimetypes may be customized and overridden using |
| 489 | @ <a href="%R/help?cmd=mimetypes">the mimetypes config setting</a>.</p> |
| 490 | zCustomList = db_get("mimetypes",0); |
| 491 | if( zCustomList!=0 ){ |
| 492 | Blob list, entry, key, val; |
| 493 | @ <h1>Repository-specific mimetypes</h1> |
| 494 | @ <p>The following extension-to-mimetype mappings are defined via |
| 495 | @ the <a href="%R/help?cmd=mimetypes">mimetypes setting</a>.</p> |
| 496 | @ <table class='sortable mimetypetable' border=1 cellpadding=0 \ |
| 497 | @ data-column-types='tt' data-init-sort='0'> |
| 498 | @ <thead> |
| 499 | @ <tr><th>Suffix<th>Mimetype |
| 500 | @ </thead> |
| 501 | @ <tbody> |
| 502 | blob_set(&list, zCustomList); |
| 503 | while( blob_line(&list, &entry)>0 ){ |
| 504 | const char *zKey; |
| 505 | if( blob_token(&entry, &key)==0 ) continue; |
| 506 | if( blob_token(&entry, &val)==0 ) continue; |
| @@ -507,15 +508,17 @@ | |
| 508 | if( zKey[0]=='.' ) zKey++; |
| 509 | @ <tr><td>%h(zKey)<td>%h(blob_str(&val))</tr> |
| 510 | nCustomEntries++; |
| 511 | } |
| 512 | fossil_free(zCustomList); |
| 513 | if( nCustomEntries==0 ){ |
| 514 | /* This can happen if the option is set to an empty/space-only |
| 515 | ** value. */ |
| 516 | @ <tr><td colspan="2"><em>none</em></tr> |
| 517 | } |
| 518 | @ </tbody></table> |
| 519 | } |
| 520 | @ <h1>Default built-in mimetypes</h1> |
| 521 | if(nCustomEntries>0){ |
| 522 | @ <p>Entries starting with an exclamation mark <em><strong>!</strong></em> |
| 523 | @ are overwritten by repository-specific settings.</p> |
| 524 | } |
| 525 |