Fossil SCM

Remove /attachaddv2 in favor of having /attachadd?target=X implement that behavior.

stephan 2026-06-03 16:59 UTC attach-v2
Commit bcdd98b8914c1954126b0fd69b28f915975e1b058d4c76c7283cdf56e74cadd8
+8 -7
--- src/attach.c
+++ src/attach.c
@@ -445,16 +445,17 @@
445445
** page=WIKIPAGE
446446
** technote=HASH
447447
** forumpost=HASH
448448
** from=URL
449449
**
450
-** Or:
450
+** Adds a POSTed file attachment to the given target.
451
+**
452
+** Or the "version 2" interface:
451453
**
452454
** target=ATTACHMENT_TARGET
453455
**
454
-** Behaves exactly like /attachaddV2.
455
-**
456
+** Behaves exactly like attachaddV2_page().
456457
*/
457458
void attachadd_page(void){
458459
const char *zPage;
459460
const char *zForumPost;
460461
const char *zTkt;
@@ -604,13 +605,13 @@
604605
fossil_free(zTargetType);
605606
fossil_free(zExtraFree);
606607
}
607608
608609
/*
609
-** WEBPAGE: attachaddV2_ajax_post hidden
610
+** WEBPAGE: attachadd_ajax_post hidden
610611
**
611
-** Used by /attachaddV2 to handle attachments via POST requests with:
612
+** Used by attachadd V2 to handle attachments via POST requests with:
612613
**
613614
** target=ATTACHMENT_TARGET
614615
** file1..fileN=FILE_OBJECTS
615616
** dryrun=0|1
616617
**
@@ -620,11 +621,11 @@
620621
**
621622
** Responds with JSON: an empty object on success and
622623
** {error:"message"} on error. The on-success response structure is
623624
** subject to amendment.
624625
*/
625
-void attachaddV2_ajax_post(void){
626
+void attachadd_ajax_post(void){
626627
const char *zTarget;
627628
char *zExtraFree = 0;
628629
int iTgtType = 0;
629630
int bNeedsModeration = 0;
630631
int i;
@@ -760,11 +761,11 @@
760761
ajax_route_error(404, "Target not found.");
761762
return;
762763
}
763764
764765
/*
765
-** WEBPAGE: attachaddV2 hidden
766
+** Proxy for /attachadd?target=X
766767
**
767768
** Lists attachments for, and can add them to, a target artifact.
768769
**
769770
** target=TKT_HASH|WIKIPAGE_NAME|TECHNOTE_HASH|FORUMPOST_HASH
770771
** from=ORIGINATING_URL
771772
--- src/attach.c
+++ src/attach.c
@@ -445,16 +445,17 @@
445 ** page=WIKIPAGE
446 ** technote=HASH
447 ** forumpost=HASH
448 ** from=URL
449 **
450 ** Or:
 
 
451 **
452 ** target=ATTACHMENT_TARGET
453 **
454 ** Behaves exactly like /attachaddV2.
455 **
456 */
457 void attachadd_page(void){
458 const char *zPage;
459 const char *zForumPost;
460 const char *zTkt;
@@ -604,13 +605,13 @@
604 fossil_free(zTargetType);
605 fossil_free(zExtraFree);
606 }
607
608 /*
609 ** WEBPAGE: attachaddV2_ajax_post hidden
610 **
611 ** Used by /attachaddV2 to handle attachments via POST requests with:
612 **
613 ** target=ATTACHMENT_TARGET
614 ** file1..fileN=FILE_OBJECTS
615 ** dryrun=0|1
616 **
@@ -620,11 +621,11 @@
620 **
621 ** Responds with JSON: an empty object on success and
622 ** {error:"message"} on error. The on-success response structure is
623 ** subject to amendment.
624 */
625 void attachaddV2_ajax_post(void){
626 const char *zTarget;
627 char *zExtraFree = 0;
628 int iTgtType = 0;
629 int bNeedsModeration = 0;
630 int i;
@@ -760,11 +761,11 @@
760 ajax_route_error(404, "Target not found.");
761 return;
762 }
763
764 /*
765 ** WEBPAGE: attachaddV2 hidden
766 **
767 ** Lists attachments for, and can add them to, a target artifact.
768 **
769 ** target=TKT_HASH|WIKIPAGE_NAME|TECHNOTE_HASH|FORUMPOST_HASH
770 ** from=ORIGINATING_URL
771
--- src/attach.c
+++ src/attach.c
@@ -445,16 +445,17 @@
445 ** page=WIKIPAGE
446 ** technote=HASH
447 ** forumpost=HASH
448 ** from=URL
449 **
450 ** Adds a POSTed file attachment to the given target.
451 **
452 ** Or the "version 2" interface:
453 **
454 ** target=ATTACHMENT_TARGET
455 **
456 ** Behaves exactly like attachaddV2_page().
 
457 */
458 void attachadd_page(void){
459 const char *zPage;
460 const char *zForumPost;
461 const char *zTkt;
@@ -604,13 +605,13 @@
605 fossil_free(zTargetType);
606 fossil_free(zExtraFree);
607 }
608
609 /*
610 ** WEBPAGE: attachadd_ajax_post hidden
611 **
612 ** Used by attachadd V2 to handle attachments via POST requests with:
613 **
614 ** target=ATTACHMENT_TARGET
615 ** file1..fileN=FILE_OBJECTS
616 ** dryrun=0|1
617 **
@@ -620,11 +621,11 @@
621 **
622 ** Responds with JSON: an empty object on success and
623 ** {error:"message"} on error. The on-success response structure is
624 ** subject to amendment.
625 */
626 void attachadd_ajax_post(void){
627 const char *zTarget;
628 char *zExtraFree = 0;
629 int iTgtType = 0;
630 int bNeedsModeration = 0;
631 int i;
@@ -760,11 +761,11 @@
761 ajax_route_error(404, "Target not found.");
762 return;
763 }
764
765 /*
766 ** Proxy for /attachadd?target=X
767 **
768 ** Lists attachments for, and can add them to, a target artifact.
769 **
770 ** target=TKT_HASH|WIKIPAGE_NAME|TECHNOTE_HASH|FORUMPOST_HASH
771 ** from=ORIGINATING_URL
772
+1 -1
--- src/forum.c
+++ src/forum.c
@@ -1046,11 +1046,11 @@
10461046
** Renders the attachment list for the given forum post.
10471047
** Emits no output if there are no attachments.
10481048
*/
10491049
static void forum_render_attachment_list(const char *zUuid){
10501050
char * zLbl = mprintf("<a href='%R/attachlist?forumpost=%s'>"
1051
- "Attachments:</a>", zUuid);
1051
+ "Attachments</a>:", zUuid);
10521052
attachment_list(zUuid, zLbl,
10531053
ATTACHLIST_HRULE_ABOVE
10541054
| ATTACHLIST_SIZE
10551055
| ATTACHLIST_HIDE_UNAPPROVED);
10561056
fossil_free(zLbl);
10571057
--- src/forum.c
+++ src/forum.c
@@ -1046,11 +1046,11 @@
1046 ** Renders the attachment list for the given forum post.
1047 ** Emits no output if there are no attachments.
1048 */
1049 static void forum_render_attachment_list(const char *zUuid){
1050 char * zLbl = mprintf("<a href='%R/attachlist?forumpost=%s'>"
1051 "Attachments:</a>", zUuid);
1052 attachment_list(zUuid, zLbl,
1053 ATTACHLIST_HRULE_ABOVE
1054 | ATTACHLIST_SIZE
1055 | ATTACHLIST_HIDE_UNAPPROVED);
1056 fossil_free(zLbl);
1057
--- src/forum.c
+++ src/forum.c
@@ -1046,11 +1046,11 @@
1046 ** Renders the attachment list for the given forum post.
1047 ** Emits no output if there are no attachments.
1048 */
1049 static void forum_render_attachment_list(const char *zUuid){
1050 char * zLbl = mprintf("<a href='%R/attachlist?forumpost=%s'>"
1051 "Attachments</a>:", zUuid);
1052 attachment_list(zUuid, zLbl,
1053 ATTACHLIST_HRULE_ABOVE
1054 | ATTACHLIST_SIZE
1055 | ATTACHLIST_HIDE_UNAPPROVED);
1056 fossil_free(zLbl);
1057
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -535,11 +535,11 @@
535535
}
536536
if( att.isDryRun ){
537537
fd.append('dryrun', '1');
538538
}
539539
let err;
540
- const resp = await window.fetch(F.repoUrl('attachaddV2_ajax_post'), {
540
+ const resp = await window.fetch(F.repoUrl('attachadd_ajax_post'), {
541541
method: 'POST',
542542
body: fd
543543
}).catch((e)=>{
544544
err = e;
545545
});
@@ -562,8 +562,8 @@
562562
}
563563
}
564564
})/*submit handler*/;
565565
updateBtnSubmit(att);
566566
F.page.attacher = att /* only for testing via dev console */;
567
- }/* /attachaddV2 */
567
+ }/* /attachadd */
568568
569569
})(window.fossil);
570570
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -535,11 +535,11 @@
535 }
536 if( att.isDryRun ){
537 fd.append('dryrun', '1');
538 }
539 let err;
540 const resp = await window.fetch(F.repoUrl('attachaddV2_ajax_post'), {
541 method: 'POST',
542 body: fd
543 }).catch((e)=>{
544 err = e;
545 });
@@ -562,8 +562,8 @@
562 }
563 }
564 })/*submit handler*/;
565 updateBtnSubmit(att);
566 F.page.attacher = att /* only for testing via dev console */;
567 }/* /attachaddV2 */
568
569 })(window.fossil);
570
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -535,11 +535,11 @@
535 }
536 if( att.isDryRun ){
537 fd.append('dryrun', '1');
538 }
539 let err;
540 const resp = await window.fetch(F.repoUrl('attachadd_ajax_post'), {
541 method: 'POST',
542 body: fd
543 }).catch((e)=>{
544 err = e;
545 });
@@ -562,8 +562,8 @@
562 }
563 }
564 })/*submit handler*/;
565 updateBtnSubmit(att);
566 F.page.attacher = att /* only for testing via dev console */;
567 }/* /attachadd */
568
569 })(window.fossil);
570

Keyboard Shortcuts

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