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.

stephan 2020-01-24 18:28 mimetypes-setting
Commit 14d1b7a9770c87fe26151b607754620d2c03024800faf8d96c3c14487de1d4c4
2 files changed +4 -2 +18 -15
+4 -2
--- src/db.c
+++ src/db.c
@@ -3451,12 +3451,14 @@
34513451
** SETTING: max-upload width=25 default=250000
34523452
** A limit on the size of uplink HTTP requests.
34533453
*/
34543454
/*
34553455
** 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.
34583460
*/
34593461
/*
34603462
** SETTING: mtime-changes boolean default=on
34613463
** Use file modification times (mtimes) to detect when
34623464
** files have been modified. If disabled, all managed files
34633465
--- 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 @@
478478
*/
479479
void mimetype_list_page(void){
480480
int i;
481481
char *zCustomList = 0; /* value of the mimetypes setting */
482482
int nCustomEntries = 0; /* number of entries in the mimetypes
483
- setting */
483
+ ** setting */
484484
mimetype_verify();
485485
style_header("Mimetype List");
486486
@ <p>The Fossil <a href="%R/help?cmd=/doc">/doc</a> page uses filename
487487
@ 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>
498490
zCustomList = db_get("mimetypes",0);
499491
if( zCustomList!=0 ){
500492
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>
501502
blob_set(&list, zCustomList);
502503
while( blob_line(&list, &entry)>0 ){
503504
const char *zKey;
504505
if( blob_token(&entry, &key)==0 ) continue;
505506
if( blob_token(&entry, &val)==0 ) continue;
@@ -507,15 +508,17 @@
507508
if( zKey[0]=='.' ) zKey++;
508509
@ <tr><td>%h(zKey)<td>%h(blob_str(&val))</tr>
509510
nCustomEntries++;
510511
}
511512
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>
512519
}
513
- if( nCustomEntries==0 ){
514
- @ <tr><td colspan="2"><em>none</em></tr>
515
- }
516
- @ </tbody></table>
517520
@ <h1>Default built-in mimetypes</h1>
518521
if(nCustomEntries>0){
519522
@ <p>Entries starting with an exclamation mark <em><strong>!</strong></em>
520523
@ are overwritten by repository-specific settings.</p>
521524
}
522525
--- 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

Keyboard Shortcuts

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