Fossil SCM
Use webpage_error() instead of fossil_fatal() in some new error cases.
Commit
9692f7ba547fdf99e95fa78c05c0d093773a7d5939c0a77e32a678a78c2b3995
Parent
50645bf5e9baeb3…
1 file changed
+7
-7
+7
-7
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -98,11 +98,11 @@ | ||
| 98 | 98 | char *zUuid; |
| 99 | 99 | if( g.perm.RdForum==0 ){ login_needed(g.anon.RdForum); return; } |
| 100 | 100 | style_header("Attachments To %h", zForumPost); |
| 101 | 101 | fnid = forumpost_head_rid2(zForumPost); |
| 102 | 102 | if( fnid<=0 ){ |
| 103 | - fossil_fatal("Invalid forum post ID: %h", zForumPost); | |
| 103 | + webpage_error("Invalid forum post ID: %h", zForumPost); | |
| 104 | 104 | } |
| 105 | 105 | zUuid = rid_to_uuid(fnid); |
| 106 | 106 | blob_append_sql(&sql, " WHERE target=%Q", zUuid); |
| 107 | 107 | fossil_free(zUuid); |
| 108 | 108 | }else if( zPage ){ |
| @@ -409,16 +409,16 @@ | ||
| 409 | 409 | int szLimit = 0; |
| 410 | 410 | |
| 411 | 411 | if( zFrom==0 ) zFrom = mprintf("%R/home"); |
| 412 | 412 | if( P("cancel") ) cgi_redirect(zFrom); |
| 413 | 413 | if( (!!zPage + !!zTkt + !!zTechNote + !!zForumPost)!=1 ){ |
| 414 | - fossil_fatal("Requires exactly one one: page=X, tkt=X, forumpost=X, or technote=X"); | |
| 414 | + webpage_error("Requires exactly one one: page=X, tkt=X, forumpost=X, or technote=X"); | |
| 415 | 415 | } |
| 416 | 416 | login_check_credentials(); |
| 417 | 417 | szLimit = db_get_int("attachment-size-limit", 0); |
| 418 | 418 | if( szContent<0 || (szLimit && szContent>szLimit) ){ |
| 419 | - fossil_fatal("Attachment %s is too large. Limit is %d bytes.", zName, | |
| 419 | + webpage_error("Attachment %s is too large. Limit is %d bytes.", zName, | |
| 420 | 420 | szLimit ? szLimit : 0x7fffffff); |
| 421 | 421 | } |
| 422 | 422 | if( zForumPost ){ |
| 423 | 423 | int fpid; |
| 424 | 424 | if( g.perm.AttachForum==0 ){ |
| @@ -425,13 +425,13 @@ | ||
| 425 | 425 | login_needed(g.anon.AttachForum); |
| 426 | 426 | return; |
| 427 | 427 | } |
| 428 | 428 | fpid = forumpost_head_rid2(zForumPost); |
| 429 | 429 | if( fpid<=0 ){ |
| 430 | - fossil_fatal("Invalid forum post ID: %h", zForumPost); | |
| 430 | + webpage_error("Invalid forum post ID: %h", zForumPost); | |
| 431 | 431 | }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){ |
| 432 | - fossil_fatal("Only admins can attach files to other users' " | |
| 432 | + webpage_error("Only admins can attach files to other users' " | |
| 433 | 433 | "forum posts."); |
| 434 | 434 | } |
| 435 | 435 | zTarget = zExtraFree = rid_to_uuid(fpid); |
| 436 | 436 | zTargetType = mprintf("Forum post <a href=\"%R/forumpost/%S\">%h</a>", |
| 437 | 437 | zTarget, zForumPost); |
| @@ -604,12 +604,12 @@ | ||
| 604 | 604 | Blob manifest; |
| 605 | 605 | Blob cksum; |
| 606 | 606 | const char *zFile = zName; |
| 607 | 607 | |
| 608 | 608 | if( !g.perm.Admin && !bUserIsOwner ){ |
| 609 | - fossil_fatal("Only admins can delete other users' attachments from " | |
| 610 | - "forum posts."); | |
| 609 | + webpage_error("Only admins can delete other users' attachments from " | |
| 610 | + "forum posts."); | |
| 611 | 611 | } |
| 612 | 612 | db_begin_transaction(); |
| 613 | 613 | blob_zero(&manifest); |
| 614 | 614 | for(i=n=0; zFile[i]; i++){ |
| 615 | 615 | if( zFile[i]=='/' || zFile[i]=='\\' ) n = i; |
| 616 | 616 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -98,11 +98,11 @@ | |
| 98 | char *zUuid; |
| 99 | if( g.perm.RdForum==0 ){ login_needed(g.anon.RdForum); return; } |
| 100 | style_header("Attachments To %h", zForumPost); |
| 101 | fnid = forumpost_head_rid2(zForumPost); |
| 102 | if( fnid<=0 ){ |
| 103 | fossil_fatal("Invalid forum post ID: %h", zForumPost); |
| 104 | } |
| 105 | zUuid = rid_to_uuid(fnid); |
| 106 | blob_append_sql(&sql, " WHERE target=%Q", zUuid); |
| 107 | fossil_free(zUuid); |
| 108 | }else if( zPage ){ |
| @@ -409,16 +409,16 @@ | |
| 409 | int szLimit = 0; |
| 410 | |
| 411 | if( zFrom==0 ) zFrom = mprintf("%R/home"); |
| 412 | if( P("cancel") ) cgi_redirect(zFrom); |
| 413 | if( (!!zPage + !!zTkt + !!zTechNote + !!zForumPost)!=1 ){ |
| 414 | fossil_fatal("Requires exactly one one: page=X, tkt=X, forumpost=X, or technote=X"); |
| 415 | } |
| 416 | login_check_credentials(); |
| 417 | szLimit = db_get_int("attachment-size-limit", 0); |
| 418 | if( szContent<0 || (szLimit && szContent>szLimit) ){ |
| 419 | fossil_fatal("Attachment %s is too large. Limit is %d bytes.", zName, |
| 420 | szLimit ? szLimit : 0x7fffffff); |
| 421 | } |
| 422 | if( zForumPost ){ |
| 423 | int fpid; |
| 424 | if( g.perm.AttachForum==0 ){ |
| @@ -425,13 +425,13 @@ | |
| 425 | login_needed(g.anon.AttachForum); |
| 426 | return; |
| 427 | } |
| 428 | fpid = forumpost_head_rid2(zForumPost); |
| 429 | if( fpid<=0 ){ |
| 430 | fossil_fatal("Invalid forum post ID: %h", zForumPost); |
| 431 | }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){ |
| 432 | fossil_fatal("Only admins can attach files to other users' " |
| 433 | "forum posts."); |
| 434 | } |
| 435 | zTarget = zExtraFree = rid_to_uuid(fpid); |
| 436 | zTargetType = mprintf("Forum post <a href=\"%R/forumpost/%S\">%h</a>", |
| 437 | zTarget, zForumPost); |
| @@ -604,12 +604,12 @@ | |
| 604 | Blob manifest; |
| 605 | Blob cksum; |
| 606 | const char *zFile = zName; |
| 607 | |
| 608 | if( !g.perm.Admin && !bUserIsOwner ){ |
| 609 | fossil_fatal("Only admins can delete other users' attachments from " |
| 610 | "forum posts."); |
| 611 | } |
| 612 | db_begin_transaction(); |
| 613 | blob_zero(&manifest); |
| 614 | for(i=n=0; zFile[i]; i++){ |
| 615 | if( zFile[i]=='/' || zFile[i]=='\\' ) n = i; |
| 616 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -98,11 +98,11 @@ | |
| 98 | char *zUuid; |
| 99 | if( g.perm.RdForum==0 ){ login_needed(g.anon.RdForum); return; } |
| 100 | style_header("Attachments To %h", zForumPost); |
| 101 | fnid = forumpost_head_rid2(zForumPost); |
| 102 | if( fnid<=0 ){ |
| 103 | webpage_error("Invalid forum post ID: %h", zForumPost); |
| 104 | } |
| 105 | zUuid = rid_to_uuid(fnid); |
| 106 | blob_append_sql(&sql, " WHERE target=%Q", zUuid); |
| 107 | fossil_free(zUuid); |
| 108 | }else if( zPage ){ |
| @@ -409,16 +409,16 @@ | |
| 409 | int szLimit = 0; |
| 410 | |
| 411 | if( zFrom==0 ) zFrom = mprintf("%R/home"); |
| 412 | if( P("cancel") ) cgi_redirect(zFrom); |
| 413 | if( (!!zPage + !!zTkt + !!zTechNote + !!zForumPost)!=1 ){ |
| 414 | webpage_error("Requires exactly one one: page=X, tkt=X, forumpost=X, or technote=X"); |
| 415 | } |
| 416 | login_check_credentials(); |
| 417 | szLimit = db_get_int("attachment-size-limit", 0); |
| 418 | if( szContent<0 || (szLimit && szContent>szLimit) ){ |
| 419 | webpage_error("Attachment %s is too large. Limit is %d bytes.", zName, |
| 420 | szLimit ? szLimit : 0x7fffffff); |
| 421 | } |
| 422 | if( zForumPost ){ |
| 423 | int fpid; |
| 424 | if( g.perm.AttachForum==0 ){ |
| @@ -425,13 +425,13 @@ | |
| 425 | login_needed(g.anon.AttachForum); |
| 426 | return; |
| 427 | } |
| 428 | fpid = forumpost_head_rid2(zForumPost); |
| 429 | if( fpid<=0 ){ |
| 430 | webpage_error("Invalid forum post ID: %h", zForumPost); |
| 431 | }else if( !g.perm.Admin && !forumpost_is_owner(fpid, 0) ){ |
| 432 | webpage_error("Only admins can attach files to other users' " |
| 433 | "forum posts."); |
| 434 | } |
| 435 | zTarget = zExtraFree = rid_to_uuid(fpid); |
| 436 | zTargetType = mprintf("Forum post <a href=\"%R/forumpost/%S\">%h</a>", |
| 437 | zTarget, zForumPost); |
| @@ -604,12 +604,12 @@ | |
| 604 | Blob manifest; |
| 605 | Blob cksum; |
| 606 | const char *zFile = zName; |
| 607 | |
| 608 | if( !g.perm.Admin && !bUserIsOwner ){ |
| 609 | webpage_error("Only admins can delete other users' attachments from " |
| 610 | "forum posts."); |
| 611 | } |
| 612 | db_begin_transaction(); |
| 613 | blob_zero(&manifest); |
| 614 | for(i=n=0; zFile[i]; i++){ |
| 615 | if( zFile[i]=='/' || zFile[i]=='\\' ) n = i; |
| 616 |