Fossil SCM

Back out [639e2cf0b7c6861], as the the attachment N-card is the mimetype of the comment, not the attachment.

stephan 2026-06-03 06:30 UTC attach-v2
Commit 7795074a1a52cd3cee1c317a6feeccf58a81fef03f4bb8504c17ea67cb989515
+1 -17
--- src/attach.c
+++ src/attach.c
@@ -346,11 +346,10 @@
346346
void attach_commit(
347347
const char *zName, /* The filename of the attachment */
348348
const char *zTarget, /* The artifact hash to attach to */
349349
const char *aContent, /* The content of the attachment */
350350
int szContent, /* The length of the attachment */
351
- const char *zMimetype, /* Content mimetype or NULL */
352351
int needModerator, /* Moderate the attachment? */
353352
const char *zComment /* The comment for the attachment */
354353
){
355354
Blob content;
356355
Blob manifest;
@@ -387,13 +386,10 @@
387386
if( n>0 ){
388387
blob_appendf(&manifest, "C %#F\n", n, zComment);
389388
}
390389
zDate = date_in_standard_format("now");
391390
blob_appendf(&manifest, "D %s\n", zDate);
392
- if( zMimetype && 0!=zMimetype[0] ){
393
- blob_appendf(&manifest, "N %F\n", zMimetype);
394
- }
395391
blob_appendf(&manifest, "U %F\n", login_name());
396392
md5sum_blob(&manifest, &cksum);
397393
blob_appendf(&manifest, "Z %b\n", &cksum);
398394
attach_put(&manifest, rid, needModerator);
399395
assert( blob_is_reset(&manifest) );
@@ -418,11 +414,10 @@
418414
const char *zTechNote = P("technote");
419415
const char *zFrom = P("from");
420416
const char *aContent = P("f");
421417
const char *zName = PD("f:filename","unknown");
422418
const char *zComment = PD("comment", "");
423
- const char *zMimetype = P("mimetype");
424419
const char *zTarget;
425420
char * zTo = 0;
426421
char *zTargetType = 0;
427422
char *zExtraFree = 0;
428423
int szContent = atoi(PD("f:bytes","0"));
@@ -505,12 +500,11 @@
505500
/* Fall through and render form. */
506501
}else if( P("ok") && szContent>0 && (goodCaptcha = captcha_is_correct(0)) ){
507502
int needModerator = (zForumPost!=0 && forum_need_moderation()) ||
508503
(zTkt!=0 && ticket_need_moderation(0)) ||
509504
(zPage!=0 && wiki_need_moderation(0));
510
- attach_commit(zName, zTarget, aContent, szContent, zMimetype,
511
- needModerator, zComment);
505
+ attach_commit(zName, zTarget, aContent, szContent, needModerator, zComment);
512506
cgi_redirect(zTo ? zTo : zFrom);
513507
}
514508
515509
style_set_current_feature("attach");
516510
style_header("Add Attachment");
@@ -1035,12 +1029,10 @@
10351029
** is to be made. The attachment will be
10361030
** to the most recently modified tech note
10371031
** with the specified timestamp.
10381032
** -t|--technote TECHNOTE-ID Specifies the technote to be
10391033
** updated by its technote id
1040
-** --mimetype TYPE Optional mimetype of the attached
1041
-** content
10421034
**
10431035
** One of PAGENAME, DATETIME or TECHNOTE-ID must be specified.
10441036
**
10451037
** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
10461038
** year-month-day form, it may be truncated, the "T" may be replaced by
@@ -1061,23 +1053,16 @@
10611053
10621054
if( strncmp(g.argv[2],"add",n)==0 ){
10631055
const char *zPageName = 0; /* Name of the wiki page to attach to */
10641056
const char *zFile; /* Name of the file to be attached */
10651057
const char *zETime; /* The name of the technote to attach to */
1066
- const char *zMimetype; /* --mimetype NAME */
10671058
Manifest *pWiki = 0; /* Parsed wiki page content */
10681059
char *zBody = 0; /* Wiki page content */
10691060
int rid;
10701061
const char *zTarget; /* Target of the attachment */
10711062
Blob content; /* The content of the attachment */
1072
- zMimetype = find_option("mimetype",0,1);
10731063
zETime = find_option("technote","t",1);
1074
- /*
1075
- FIXME/TODO (2026-06-02): adapt this to use
1076
- attachment_target_type() and, when attaching to tech notes and
1077
- forum posts, always attach to their root version.
1078
- */
10791064
if( !zETime ){
10801065
if( g.argc!=5 ){
10811066
usage("add PAGENAME FILENAME");
10821067
}
10831068
zPageName = g.argv[3];
@@ -1120,11 +1105,10 @@
11201105
attach_commit(
11211106
zFile, /* The filename of the attachment */
11221107
zTarget, /* The artifact hash to attach to */
11231108
blob_buffer(&content), /* The content of the attachment */
11241109
blob_size(&content), /* The length of the attachment */
1125
- zMimetype, /* Mimetype */
11261110
0, /* No need to moderate the attachment */
11271111
"" /* Empty attachment comment */
11281112
);
11291113
if( !zETime ){
11301114
fossil_print("Attached %s to wiki page %s.\n", zFile, zPageName);
11311115
--- src/attach.c
+++ src/attach.c
@@ -346,11 +346,10 @@
346 void attach_commit(
347 const char *zName, /* The filename of the attachment */
348 const char *zTarget, /* The artifact hash to attach to */
349 const char *aContent, /* The content of the attachment */
350 int szContent, /* The length of the attachment */
351 const char *zMimetype, /* Content mimetype or NULL */
352 int needModerator, /* Moderate the attachment? */
353 const char *zComment /* The comment for the attachment */
354 ){
355 Blob content;
356 Blob manifest;
@@ -387,13 +386,10 @@
387 if( n>0 ){
388 blob_appendf(&manifest, "C %#F\n", n, zComment);
389 }
390 zDate = date_in_standard_format("now");
391 blob_appendf(&manifest, "D %s\n", zDate);
392 if( zMimetype && 0!=zMimetype[0] ){
393 blob_appendf(&manifest, "N %F\n", zMimetype);
394 }
395 blob_appendf(&manifest, "U %F\n", login_name());
396 md5sum_blob(&manifest, &cksum);
397 blob_appendf(&manifest, "Z %b\n", &cksum);
398 attach_put(&manifest, rid, needModerator);
399 assert( blob_is_reset(&manifest) );
@@ -418,11 +414,10 @@
418 const char *zTechNote = P("technote");
419 const char *zFrom = P("from");
420 const char *aContent = P("f");
421 const char *zName = PD("f:filename","unknown");
422 const char *zComment = PD("comment", "");
423 const char *zMimetype = P("mimetype");
424 const char *zTarget;
425 char * zTo = 0;
426 char *zTargetType = 0;
427 char *zExtraFree = 0;
428 int szContent = atoi(PD("f:bytes","0"));
@@ -505,12 +500,11 @@
505 /* Fall through and render form. */
506 }else if( P("ok") && szContent>0 && (goodCaptcha = captcha_is_correct(0)) ){
507 int needModerator = (zForumPost!=0 && forum_need_moderation()) ||
508 (zTkt!=0 && ticket_need_moderation(0)) ||
509 (zPage!=0 && wiki_need_moderation(0));
510 attach_commit(zName, zTarget, aContent, szContent, zMimetype,
511 needModerator, zComment);
512 cgi_redirect(zTo ? zTo : zFrom);
513 }
514
515 style_set_current_feature("attach");
516 style_header("Add Attachment");
@@ -1035,12 +1029,10 @@
1035 ** is to be made. The attachment will be
1036 ** to the most recently modified tech note
1037 ** with the specified timestamp.
1038 ** -t|--technote TECHNOTE-ID Specifies the technote to be
1039 ** updated by its technote id
1040 ** --mimetype TYPE Optional mimetype of the attached
1041 ** content
1042 **
1043 ** One of PAGENAME, DATETIME or TECHNOTE-ID must be specified.
1044 **
1045 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
1046 ** year-month-day form, it may be truncated, the "T" may be replaced by
@@ -1061,23 +1053,16 @@
1061
1062 if( strncmp(g.argv[2],"add",n)==0 ){
1063 const char *zPageName = 0; /* Name of the wiki page to attach to */
1064 const char *zFile; /* Name of the file to be attached */
1065 const char *zETime; /* The name of the technote to attach to */
1066 const char *zMimetype; /* --mimetype NAME */
1067 Manifest *pWiki = 0; /* Parsed wiki page content */
1068 char *zBody = 0; /* Wiki page content */
1069 int rid;
1070 const char *zTarget; /* Target of the attachment */
1071 Blob content; /* The content of the attachment */
1072 zMimetype = find_option("mimetype",0,1);
1073 zETime = find_option("technote","t",1);
1074 /*
1075 FIXME/TODO (2026-06-02): adapt this to use
1076 attachment_target_type() and, when attaching to tech notes and
1077 forum posts, always attach to their root version.
1078 */
1079 if( !zETime ){
1080 if( g.argc!=5 ){
1081 usage("add PAGENAME FILENAME");
1082 }
1083 zPageName = g.argv[3];
@@ -1120,11 +1105,10 @@
1120 attach_commit(
1121 zFile, /* The filename of the attachment */
1122 zTarget, /* The artifact hash to attach to */
1123 blob_buffer(&content), /* The content of the attachment */
1124 blob_size(&content), /* The length of the attachment */
1125 zMimetype, /* Mimetype */
1126 0, /* No need to moderate the attachment */
1127 "" /* Empty attachment comment */
1128 );
1129 if( !zETime ){
1130 fossil_print("Attached %s to wiki page %s.\n", zFile, zPageName);
1131
--- src/attach.c
+++ src/attach.c
@@ -346,11 +346,10 @@
346 void attach_commit(
347 const char *zName, /* The filename of the attachment */
348 const char *zTarget, /* The artifact hash to attach to */
349 const char *aContent, /* The content of the attachment */
350 int szContent, /* The length of the attachment */
 
351 int needModerator, /* Moderate the attachment? */
352 const char *zComment /* The comment for the attachment */
353 ){
354 Blob content;
355 Blob manifest;
@@ -387,13 +386,10 @@
386 if( n>0 ){
387 blob_appendf(&manifest, "C %#F\n", n, zComment);
388 }
389 zDate = date_in_standard_format("now");
390 blob_appendf(&manifest, "D %s\n", zDate);
 
 
 
391 blob_appendf(&manifest, "U %F\n", login_name());
392 md5sum_blob(&manifest, &cksum);
393 blob_appendf(&manifest, "Z %b\n", &cksum);
394 attach_put(&manifest, rid, needModerator);
395 assert( blob_is_reset(&manifest) );
@@ -418,11 +414,10 @@
414 const char *zTechNote = P("technote");
415 const char *zFrom = P("from");
416 const char *aContent = P("f");
417 const char *zName = PD("f:filename","unknown");
418 const char *zComment = PD("comment", "");
 
419 const char *zTarget;
420 char * zTo = 0;
421 char *zTargetType = 0;
422 char *zExtraFree = 0;
423 int szContent = atoi(PD("f:bytes","0"));
@@ -505,12 +500,11 @@
500 /* Fall through and render form. */
501 }else if( P("ok") && szContent>0 && (goodCaptcha = captcha_is_correct(0)) ){
502 int needModerator = (zForumPost!=0 && forum_need_moderation()) ||
503 (zTkt!=0 && ticket_need_moderation(0)) ||
504 (zPage!=0 && wiki_need_moderation(0));
505 attach_commit(zName, zTarget, aContent, szContent, needModerator, zComment);
 
506 cgi_redirect(zTo ? zTo : zFrom);
507 }
508
509 style_set_current_feature("attach");
510 style_header("Add Attachment");
@@ -1035,12 +1029,10 @@
1029 ** is to be made. The attachment will be
1030 ** to the most recently modified tech note
1031 ** with the specified timestamp.
1032 ** -t|--technote TECHNOTE-ID Specifies the technote to be
1033 ** updated by its technote id
 
 
1034 **
1035 ** One of PAGENAME, DATETIME or TECHNOTE-ID must be specified.
1036 **
1037 ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in
1038 ** year-month-day form, it may be truncated, the "T" may be replaced by
@@ -1061,23 +1053,16 @@
1053
1054 if( strncmp(g.argv[2],"add",n)==0 ){
1055 const char *zPageName = 0; /* Name of the wiki page to attach to */
1056 const char *zFile; /* Name of the file to be attached */
1057 const char *zETime; /* The name of the technote to attach to */
 
1058 Manifest *pWiki = 0; /* Parsed wiki page content */
1059 char *zBody = 0; /* Wiki page content */
1060 int rid;
1061 const char *zTarget; /* Target of the attachment */
1062 Blob content; /* The content of the attachment */
 
1063 zETime = find_option("technote","t",1);
 
 
 
 
 
1064 if( !zETime ){
1065 if( g.argc!=5 ){
1066 usage("add PAGENAME FILENAME");
1067 }
1068 zPageName = g.argv[3];
@@ -1120,11 +1105,10 @@
1105 attach_commit(
1106 zFile, /* The filename of the attachment */
1107 zTarget, /* The artifact hash to attach to */
1108 blob_buffer(&content), /* The content of the attachment */
1109 blob_size(&content), /* The length of the attachment */
 
1110 0, /* No need to moderate the attachment */
1111 "" /* Empty attachment comment */
1112 );
1113 if( !zETime ){
1114 fossil_print("Attached %s to wiki page %s.\n", zFile, zPageName);
1115
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -378,13 +378,10 @@
378378
fd.append(`${namePrefix}${suffix}`, s.content, s.name);
379379
const d = s.description?.trim?.();
380380
if( d ){
381381
fd.append(`${namePrefix}${suffix}_desc`, d);
382382
}
383
- if( s.mimetype ){
384
- fd.append(`${namePrefix}${suffix}_mimetype`, s.mimetype);
385
- }
386383
}
387384
return i;
388385
}
389386
}/*Attacher*/;
390387
F.Attacher = Attacher;
391388
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -378,13 +378,10 @@
378 fd.append(`${namePrefix}${suffix}`, s.content, s.name);
379 const d = s.description?.trim?.();
380 if( d ){
381 fd.append(`${namePrefix}${suffix}_desc`, d);
382 }
383 if( s.mimetype ){
384 fd.append(`${namePrefix}${suffix}_mimetype`, s.mimetype);
385 }
386 }
387 return i;
388 }
389 }/*Attacher*/;
390 F.Attacher = Attacher;
391
--- src/fossil.attach.js
+++ src/fossil.attach.js
@@ -378,13 +378,10 @@
378 fd.append(`${namePrefix}${suffix}`, s.content, s.name);
379 const d = s.description?.trim?.();
380 if( d ){
381 fd.append(`${namePrefix}${suffix}_desc`, d);
382 }
 
 
 
383 }
384 return i;
385 }
386 }/*Attacher*/;
387 F.Attacher = Attacher;
388
+1 -2
--- src/manifest.c
+++ src/manifest.c
@@ -863,12 +863,11 @@
863863
}
864864
865865
/*
866866
** N <uuid>
867867
**
868
- ** An N-line identifies the mimetype of wiki or comment text,
869
- ** as well as that of the content of attachments.
868
+ ** An N-line identifies the mimetype of wiki or comment text.
870869
*/
871870
case 'N': {
872871
if( p->zMimetype!=0 ) SYNTAX("more than one N-card");
873872
p->zMimetype = next_token(&x,0);
874873
if( p->zMimetype==0 ) SYNTAX("missing mimetype on N-card");
875874
--- src/manifest.c
+++ src/manifest.c
@@ -863,12 +863,11 @@
863 }
864
865 /*
866 ** N <uuid>
867 **
868 ** An N-line identifies the mimetype of wiki or comment text,
869 ** as well as that of the content of attachments.
870 */
871 case 'N': {
872 if( p->zMimetype!=0 ) SYNTAX("more than one N-card");
873 p->zMimetype = next_token(&x,0);
874 if( p->zMimetype==0 ) SYNTAX("missing mimetype on N-card");
875
--- src/manifest.c
+++ src/manifest.c
@@ -863,12 +863,11 @@
863 }
864
865 /*
866 ** N <uuid>
867 **
868 ** An N-line identifies the mimetype of wiki or comment text.
 
869 */
870 case 'N': {
871 if( p->zMimetype!=0 ) SYNTAX("more than one N-card");
872 p->zMimetype = next_token(&x,0);
873 if( p->zMimetype==0 ) SYNTAX("missing mimetype on N-card");
874

Keyboard Shortcuts

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