Fossil SCM

Ensure that the legacy /attachadd form redirects back to the page for the attachment's target unless it's told otherwise via ?from=X.

stephan 2026-06-14 08:47 UTC forum-editor-2026
Commit dab3d6817f874ef1cc17564311b248cee0f948e34d9bfb473821d02d5ac620e9
1 file changed +6 -3
+6 -3
--- src/attach.c
+++ src/attach.c
@@ -1090,13 +1090,15 @@
10901090
@ <p class="generalError">Error: Incorrect security code.</p>
10911091
}
10921092
@ <h2>Attachments for %s(zTargetType)</h2>
10931093
attachment_list(zTarget, NULL,
10941094
ATTACHLIST_SIZE | ATTACHLIST_HIDE_UNAPPROVED);
1095
- attach_render_legacy_form(noJsArgs[0], noJsArgs[1], noJsArgs[2],
1096
- noJsArgs[3], 0,
1097
- zFrom ? zFrom : mprintf("%R/home"));
1095
+ attach_render_legacy_form(
1096
+ noJsArgs[0], noJsArgs[1], noJsArgs[2],
1097
+ noJsArgs[3], 0,
1098
+ zFrom ? zFrom : (zTo ? zTo : (zTo=mprintf("%R/home")))
1099
+ );
10981100
@ <div id='attachadd-form-wrapper' class='hidden'>
10991101
/* fossil.attach.js populates this DIV with the attachment widget,
11001102
** imports these hidden fields, and removes the legacy form. */
11011103
@ <input type="hidden" name="target" value="%h(zTarget)">
11021104
if( zFrom ){
@@ -1111,10 +1113,11 @@
11111113
builtin_fossil_js_bundle_or("attach", NULL);
11121114
db_end_transaction(0);
11131115
style_finish_page();
11141116
fossil_free(zTargetType);
11151117
fossil_free(zExtraFree);
1118
+ fossil_free(zTo);
11161119
}
11171120
11181121
/*
11191122
** WEBPAGE: ainfo
11201123
** URL: /ainfo?name=ARTIFACTID
11211124
--- src/attach.c
+++ src/attach.c
@@ -1090,13 +1090,15 @@
1090 @ <p class="generalError">Error: Incorrect security code.</p>
1091 }
1092 @ <h2>Attachments for %s(zTargetType)</h2>
1093 attachment_list(zTarget, NULL,
1094 ATTACHLIST_SIZE | ATTACHLIST_HIDE_UNAPPROVED);
1095 attach_render_legacy_form(noJsArgs[0], noJsArgs[1], noJsArgs[2],
1096 noJsArgs[3], 0,
1097 zFrom ? zFrom : mprintf("%R/home"));
 
 
1098 @ <div id='attachadd-form-wrapper' class='hidden'>
1099 /* fossil.attach.js populates this DIV with the attachment widget,
1100 ** imports these hidden fields, and removes the legacy form. */
1101 @ <input type="hidden" name="target" value="%h(zTarget)">
1102 if( zFrom ){
@@ -1111,10 +1113,11 @@
1111 builtin_fossil_js_bundle_or("attach", NULL);
1112 db_end_transaction(0);
1113 style_finish_page();
1114 fossil_free(zTargetType);
1115 fossil_free(zExtraFree);
 
1116 }
1117
1118 /*
1119 ** WEBPAGE: ainfo
1120 ** URL: /ainfo?name=ARTIFACTID
1121
--- src/attach.c
+++ src/attach.c
@@ -1090,13 +1090,15 @@
1090 @ <p class="generalError">Error: Incorrect security code.</p>
1091 }
1092 @ <h2>Attachments for %s(zTargetType)</h2>
1093 attachment_list(zTarget, NULL,
1094 ATTACHLIST_SIZE | ATTACHLIST_HIDE_UNAPPROVED);
1095 attach_render_legacy_form(
1096 noJsArgs[0], noJsArgs[1], noJsArgs[2],
1097 noJsArgs[3], 0,
1098 zFrom ? zFrom : (zTo ? zTo : (zTo=mprintf("%R/home")))
1099 );
1100 @ <div id='attachadd-form-wrapper' class='hidden'>
1101 /* fossil.attach.js populates this DIV with the attachment widget,
1102 ** imports these hidden fields, and removes the legacy form. */
1103 @ <input type="hidden" name="target" value="%h(zTarget)">
1104 if( zFrom ){
@@ -1111,10 +1113,11 @@
1113 builtin_fossil_js_bundle_or("attach", NULL);
1114 db_end_transaction(0);
1115 style_finish_page();
1116 fossil_free(zTargetType);
1117 fossil_free(zExtraFree);
1118 fossil_free(zTo);
1119 }
1120
1121 /*
1122 ** WEBPAGE: ainfo
1123 ** URL: /ainfo?name=ARTIFACTID
1124

Keyboard Shortcuts

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