Fossil SCM
Fix the /doc webpage so that it does not call fossil_fatal() when it cannot find the requested document. It simply does a 404 routine. By not calling fossil_fatal(), it avoids unnecessary entries in the error log.
Commit
29cb8260c0d62ec60ff098bbe99336eb2d46a2d53e39bcc2b8540a1aa0167242
Parent
4eb3e0f20e04edc…
2 files changed
+2
-3
-2
+2
-3
| --- src/doc.c | ||
| +++ src/doc.c | ||
| @@ -664,12 +664,12 @@ | ||
| 664 | 664 | && blob_read_from_file(&filebody, zFullpath, RepoFILE)>0 ){ |
| 665 | 665 | rid = 1; /* Fake RID just to get the loop to end */ |
| 666 | 666 | } |
| 667 | 667 | fossil_free(zFullpath); |
| 668 | 668 | }else{ |
| 669 | - vid = name_to_typed_rid(zCheckin, "ci"); | |
| 670 | - rid = doc_load_content(vid, zName, &filebody); | |
| 669 | + vid = symbolic_name_to_rid(zCheckin, "ci"); | |
| 670 | + rid = vid>0 ? doc_load_content(vid, zName, &filebody) : 0; | |
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | g.zPath = mprintf("%s/%s", g.zPath, zPathSuffix); |
| 674 | 674 | if( rid==0 ) goto doc_not_found; |
| 675 | 675 | blob_to_utf8_no_bom(&filebody, 0); |
| @@ -764,11 +764,10 @@ | ||
| 764 | 764 | @ <p>Document %h(zOrigName) not found |
| 765 | 765 | if( fossil_strcmp(zCheckin,"ckout")!=0 ){ |
| 766 | 766 | @ in %z(href("%R/tree?ci=%T",zCheckin))%h(zCheckin)</a> |
| 767 | 767 | } |
| 768 | 768 | style_footer(); |
| 769 | - db_end_transaction(0); | |
| 770 | 769 | return; |
| 771 | 770 | } |
| 772 | 771 | |
| 773 | 772 | /* |
| 774 | 773 | ** The default logo. |
| 775 | 774 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -664,12 +664,12 @@ | |
| 664 | && blob_read_from_file(&filebody, zFullpath, RepoFILE)>0 ){ |
| 665 | rid = 1; /* Fake RID just to get the loop to end */ |
| 666 | } |
| 667 | fossil_free(zFullpath); |
| 668 | }else{ |
| 669 | vid = name_to_typed_rid(zCheckin, "ci"); |
| 670 | rid = doc_load_content(vid, zName, &filebody); |
| 671 | } |
| 672 | } |
| 673 | g.zPath = mprintf("%s/%s", g.zPath, zPathSuffix); |
| 674 | if( rid==0 ) goto doc_not_found; |
| 675 | blob_to_utf8_no_bom(&filebody, 0); |
| @@ -764,11 +764,10 @@ | |
| 764 | @ <p>Document %h(zOrigName) not found |
| 765 | if( fossil_strcmp(zCheckin,"ckout")!=0 ){ |
| 766 | @ in %z(href("%R/tree?ci=%T",zCheckin))%h(zCheckin)</a> |
| 767 | } |
| 768 | style_footer(); |
| 769 | db_end_transaction(0); |
| 770 | return; |
| 771 | } |
| 772 | |
| 773 | /* |
| 774 | ** The default logo. |
| 775 |
| --- src/doc.c | |
| +++ src/doc.c | |
| @@ -664,12 +664,12 @@ | |
| 664 | && blob_read_from_file(&filebody, zFullpath, RepoFILE)>0 ){ |
| 665 | rid = 1; /* Fake RID just to get the loop to end */ |
| 666 | } |
| 667 | fossil_free(zFullpath); |
| 668 | }else{ |
| 669 | vid = symbolic_name_to_rid(zCheckin, "ci"); |
| 670 | rid = vid>0 ? doc_load_content(vid, zName, &filebody) : 0; |
| 671 | } |
| 672 | } |
| 673 | g.zPath = mprintf("%s/%s", g.zPath, zPathSuffix); |
| 674 | if( rid==0 ) goto doc_not_found; |
| 675 | blob_to_utf8_no_bom(&filebody, 0); |
| @@ -764,11 +764,10 @@ | |
| 764 | @ <p>Document %h(zOrigName) not found |
| 765 | if( fossil_strcmp(zCheckin,"ckout")!=0 ){ |
| 766 | @ in %z(href("%R/tree?ci=%T",zCheckin))%h(zCheckin)</a> |
| 767 | } |
| 768 | style_footer(); |
| 769 | return; |
| 770 | } |
| 771 | |
| 772 | /* |
| 773 | ** The default logo. |
| 774 |
-2
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -423,14 +423,12 @@ | ||
| 423 | 423 | int rid; |
| 424 | 424 | |
| 425 | 425 | if( zName==0 || zName[0]==0 ) return 0; |
| 426 | 426 | rid = symbolic_name_to_rid(zName, zType); |
| 427 | 427 | if( rid<0 ){ |
| 428 | - cgi_set_status(404, "Not Found"); | |
| 429 | 428 | fossil_fatal("ambiguous name: %s", zName); |
| 430 | 429 | }else if( rid==0 ){ |
| 431 | - cgi_set_status(404, "Not Found"); | |
| 432 | 430 | fossil_fatal("not found: %s", zName); |
| 433 | 431 | } |
| 434 | 432 | return rid; |
| 435 | 433 | } |
| 436 | 434 | int name_to_rid(const char *zName){ |
| 437 | 435 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -423,14 +423,12 @@ | |
| 423 | int rid; |
| 424 | |
| 425 | if( zName==0 || zName[0]==0 ) return 0; |
| 426 | rid = symbolic_name_to_rid(zName, zType); |
| 427 | if( rid<0 ){ |
| 428 | cgi_set_status(404, "Not Found"); |
| 429 | fossil_fatal("ambiguous name: %s", zName); |
| 430 | }else if( rid==0 ){ |
| 431 | cgi_set_status(404, "Not Found"); |
| 432 | fossil_fatal("not found: %s", zName); |
| 433 | } |
| 434 | return rid; |
| 435 | } |
| 436 | int name_to_rid(const char *zName){ |
| 437 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -423,14 +423,12 @@ | |
| 423 | int rid; |
| 424 | |
| 425 | if( zName==0 || zName[0]==0 ) return 0; |
| 426 | rid = symbolic_name_to_rid(zName, zType); |
| 427 | if( rid<0 ){ |
| 428 | fossil_fatal("ambiguous name: %s", zName); |
| 429 | }else if( rid==0 ){ |
| 430 | fossil_fatal("not found: %s", zName); |
| 431 | } |
| 432 | return rid; |
| 433 | } |
| 434 | int name_to_rid(const char *zName){ |
| 435 |