Fossil SCM
Add some comments explaining the reason behind a particular attachment-handling case. Remove the new (in this branch) CFTYPE_TECHNOTE alias for CFTYPE_EVENT.
Commit
782b8b8e81abc83303f09a8550d16818a7151388c5ca45e6b2925217b6379076
Parent
554fdf8f503f22b…
2 files changed
+8
-8
+5
-2
+8
-8
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -22,11 +22,11 @@ | ||
| 22 | 22 | #include <assert.h> |
| 23 | 23 | |
| 24 | 24 | /* |
| 25 | 25 | ** Given a presumedly legal attachment target name, this guesses the |
| 26 | 26 | ** target type and returns one of CFTYPE_FORUM, CFTYPE_WIKI, |
| 27 | -** CFTYPE_TICKET, or CFTYPE_TECHNOTE. Returns 0 if it cannot | |
| 27 | +** CFTYPE_TICKET, or CFTYPE_EVENT. Returns 0 if it cannot | |
| 28 | 28 | ** distinguish the target type. |
| 29 | 29 | ** |
| 30 | 30 | ** In the case of CFTYPE_FORUM, it is up to the caller to ensure that, |
| 31 | 31 | ** if needed, they resolve zTarget using forumpost_head_rid2() so that |
| 32 | 32 | ** they get the RID of the earliest version of the post, as that is |
| @@ -44,11 +44,11 @@ | ||
| 44 | 44 | "SELECT CASE " |
| 45 | 45 | "WHEN 'tkt-'||:tgt IN (SELECT tagname FROM tag) THEN %d " |
| 46 | 46 | "WHEN 'event-'||:tgt IN (SELECT tagname FROM tag) THEN %d " |
| 47 | 47 | "WHEN 'wiki-'||:tgt IN (SELECT tagname FROM tag) THEN %d " |
| 48 | 48 | "ELSE 0 END", |
| 49 | - CFTYPE_TICKET, CFTYPE_TECHNOTE, CFTYPE_WIKI | |
| 49 | + CFTYPE_TICKET, CFTYPE_EVENT, CFTYPE_WIKI | |
| 50 | 50 | ); |
| 51 | 51 | } |
| 52 | 52 | db_bind_text(&q, ":tgt", zTarget); |
| 53 | 53 | if( SQLITE_ROW==db_step(&q) ){ |
| 54 | 54 | rc = db_column_int(&q, 0); |
| @@ -150,11 +150,11 @@ | ||
| 150 | 150 | } |
| 151 | 151 | switch( type ){ |
| 152 | 152 | case CFTYPE_TICKET: |
| 153 | 153 | zUrlTail = mprintf("tkt=%s&file=%t", zTarget, zFilename); |
| 154 | 154 | break; |
| 155 | - case CFTYPE_TECHNOTE: | |
| 155 | + case CFTYPE_EVENT: | |
| 156 | 156 | zUrlTail = mprintf("technote=%s&file=%t", zTarget, zFilename); |
| 157 | 157 | break; |
| 158 | 158 | case CFTYPE_FORUM: |
| 159 | 159 | zUrlTail = mprintf("forumpost=%t&file=%t", zTarget, zFilename); |
| 160 | 160 | break; |
| @@ -180,11 +180,11 @@ | ||
| 180 | 180 | switch( type ){ |
| 181 | 181 | case CFTYPE_TICKET: |
| 182 | 182 | @ %s(zSrc) ticket <a href="%R/tktview?name=%s(zTarget)"> |
| 183 | 183 | @ %S(zTarget)</a> |
| 184 | 184 | break; |
| 185 | - case CFTYPE_TECHNOTE: | |
| 185 | + case CFTYPE_EVENT: | |
| 186 | 186 | @ %s(zSrc) tech note <a href="%R/technote/%s(zTarget)"> |
| 187 | 187 | @ %S(zTarget)</a> |
| 188 | 188 | break; |
| 189 | 189 | case CFTYPE_WIKI: |
| 190 | 190 | @ %s(zSrc) wiki page <a href="%R/wiki?name=%t(zTarget)"> |
| @@ -816,15 +816,15 @@ | ||
| 816 | 816 | @ %s(zHeader) |
| 817 | 817 | @ <ul> |
| 818 | 818 | } |
| 819 | 819 | cnt++; |
| 820 | 820 | switch( iAType ){ |
| 821 | - case CFTYPE_TICKET: zTypeArg = "tkt"; break; | |
| 822 | - case CFTYPE_FORUM: zTypeArg = "forumpost"; break; | |
| 823 | - case CFTYPE_TECHNOTE: zTypeArg = "technote"; break; | |
| 821 | + case CFTYPE_TICKET: zTypeArg = "tkt"; break; | |
| 822 | + case CFTYPE_FORUM: zTypeArg = "forumpost"; break; | |
| 823 | + case CFTYPE_EVENT: zTypeArg = "technote"; break; | |
| 824 | 824 | case CFTYPE_WIKI: |
| 825 | - default: zTypeArg = "page"; break; | |
| 825 | + default: zTypeArg = "page"; break; | |
| 826 | 826 | } |
| 827 | 827 | @ <li> |
| 828 | 828 | @ <a href="%R/artifact/%!S(zSrc)"%s(zLinkTgt)>%h(zFile)</a> |
| 829 | 829 | if( flags & ATTACHLIST_SIZE ){ |
| 830 | 830 | const int sz = db_int(0,"SELECT size FROM blob WHERE uuid=%Q", zSrc); |
| 831 | 831 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -22,11 +22,11 @@ | |
| 22 | #include <assert.h> |
| 23 | |
| 24 | /* |
| 25 | ** Given a presumedly legal attachment target name, this guesses the |
| 26 | ** target type and returns one of CFTYPE_FORUM, CFTYPE_WIKI, |
| 27 | ** CFTYPE_TICKET, or CFTYPE_TECHNOTE. Returns 0 if it cannot |
| 28 | ** distinguish the target type. |
| 29 | ** |
| 30 | ** In the case of CFTYPE_FORUM, it is up to the caller to ensure that, |
| 31 | ** if needed, they resolve zTarget using forumpost_head_rid2() so that |
| 32 | ** they get the RID of the earliest version of the post, as that is |
| @@ -44,11 +44,11 @@ | |
| 44 | "SELECT CASE " |
| 45 | "WHEN 'tkt-'||:tgt IN (SELECT tagname FROM tag) THEN %d " |
| 46 | "WHEN 'event-'||:tgt IN (SELECT tagname FROM tag) THEN %d " |
| 47 | "WHEN 'wiki-'||:tgt IN (SELECT tagname FROM tag) THEN %d " |
| 48 | "ELSE 0 END", |
| 49 | CFTYPE_TICKET, CFTYPE_TECHNOTE, CFTYPE_WIKI |
| 50 | ); |
| 51 | } |
| 52 | db_bind_text(&q, ":tgt", zTarget); |
| 53 | if( SQLITE_ROW==db_step(&q) ){ |
| 54 | rc = db_column_int(&q, 0); |
| @@ -150,11 +150,11 @@ | |
| 150 | } |
| 151 | switch( type ){ |
| 152 | case CFTYPE_TICKET: |
| 153 | zUrlTail = mprintf("tkt=%s&file=%t", zTarget, zFilename); |
| 154 | break; |
| 155 | case CFTYPE_TECHNOTE: |
| 156 | zUrlTail = mprintf("technote=%s&file=%t", zTarget, zFilename); |
| 157 | break; |
| 158 | case CFTYPE_FORUM: |
| 159 | zUrlTail = mprintf("forumpost=%t&file=%t", zTarget, zFilename); |
| 160 | break; |
| @@ -180,11 +180,11 @@ | |
| 180 | switch( type ){ |
| 181 | case CFTYPE_TICKET: |
| 182 | @ %s(zSrc) ticket <a href="%R/tktview?name=%s(zTarget)"> |
| 183 | @ %S(zTarget)</a> |
| 184 | break; |
| 185 | case CFTYPE_TECHNOTE: |
| 186 | @ %s(zSrc) tech note <a href="%R/technote/%s(zTarget)"> |
| 187 | @ %S(zTarget)</a> |
| 188 | break; |
| 189 | case CFTYPE_WIKI: |
| 190 | @ %s(zSrc) wiki page <a href="%R/wiki?name=%t(zTarget)"> |
| @@ -816,15 +816,15 @@ | |
| 816 | @ %s(zHeader) |
| 817 | @ <ul> |
| 818 | } |
| 819 | cnt++; |
| 820 | switch( iAType ){ |
| 821 | case CFTYPE_TICKET: zTypeArg = "tkt"; break; |
| 822 | case CFTYPE_FORUM: zTypeArg = "forumpost"; break; |
| 823 | case CFTYPE_TECHNOTE: zTypeArg = "technote"; break; |
| 824 | case CFTYPE_WIKI: |
| 825 | default: zTypeArg = "page"; break; |
| 826 | } |
| 827 | @ <li> |
| 828 | @ <a href="%R/artifact/%!S(zSrc)"%s(zLinkTgt)>%h(zFile)</a> |
| 829 | if( flags & ATTACHLIST_SIZE ){ |
| 830 | const int sz = db_int(0,"SELECT size FROM blob WHERE uuid=%Q", zSrc); |
| 831 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -22,11 +22,11 @@ | |
| 22 | #include <assert.h> |
| 23 | |
| 24 | /* |
| 25 | ** Given a presumedly legal attachment target name, this guesses the |
| 26 | ** target type and returns one of CFTYPE_FORUM, CFTYPE_WIKI, |
| 27 | ** CFTYPE_TICKET, or CFTYPE_EVENT. Returns 0 if it cannot |
| 28 | ** distinguish the target type. |
| 29 | ** |
| 30 | ** In the case of CFTYPE_FORUM, it is up to the caller to ensure that, |
| 31 | ** if needed, they resolve zTarget using forumpost_head_rid2() so that |
| 32 | ** they get the RID of the earliest version of the post, as that is |
| @@ -44,11 +44,11 @@ | |
| 44 | "SELECT CASE " |
| 45 | "WHEN 'tkt-'||:tgt IN (SELECT tagname FROM tag) THEN %d " |
| 46 | "WHEN 'event-'||:tgt IN (SELECT tagname FROM tag) THEN %d " |
| 47 | "WHEN 'wiki-'||:tgt IN (SELECT tagname FROM tag) THEN %d " |
| 48 | "ELSE 0 END", |
| 49 | CFTYPE_TICKET, CFTYPE_EVENT, CFTYPE_WIKI |
| 50 | ); |
| 51 | } |
| 52 | db_bind_text(&q, ":tgt", zTarget); |
| 53 | if( SQLITE_ROW==db_step(&q) ){ |
| 54 | rc = db_column_int(&q, 0); |
| @@ -150,11 +150,11 @@ | |
| 150 | } |
| 151 | switch( type ){ |
| 152 | case CFTYPE_TICKET: |
| 153 | zUrlTail = mprintf("tkt=%s&file=%t", zTarget, zFilename); |
| 154 | break; |
| 155 | case CFTYPE_EVENT: |
| 156 | zUrlTail = mprintf("technote=%s&file=%t", zTarget, zFilename); |
| 157 | break; |
| 158 | case CFTYPE_FORUM: |
| 159 | zUrlTail = mprintf("forumpost=%t&file=%t", zTarget, zFilename); |
| 160 | break; |
| @@ -180,11 +180,11 @@ | |
| 180 | switch( type ){ |
| 181 | case CFTYPE_TICKET: |
| 182 | @ %s(zSrc) ticket <a href="%R/tktview?name=%s(zTarget)"> |
| 183 | @ %S(zTarget)</a> |
| 184 | break; |
| 185 | case CFTYPE_EVENT: |
| 186 | @ %s(zSrc) tech note <a href="%R/technote/%s(zTarget)"> |
| 187 | @ %S(zTarget)</a> |
| 188 | break; |
| 189 | case CFTYPE_WIKI: |
| 190 | @ %s(zSrc) wiki page <a href="%R/wiki?name=%t(zTarget)"> |
| @@ -816,15 +816,15 @@ | |
| 816 | @ %s(zHeader) |
| 817 | @ <ul> |
| 818 | } |
| 819 | cnt++; |
| 820 | switch( iAType ){ |
| 821 | case CFTYPE_TICKET: zTypeArg = "tkt"; break; |
| 822 | case CFTYPE_FORUM: zTypeArg = "forumpost"; break; |
| 823 | case CFTYPE_EVENT: zTypeArg = "technote"; break; |
| 824 | case CFTYPE_WIKI: |
| 825 | default: zTypeArg = "page"; break; |
| 826 | } |
| 827 | @ <li> |
| 828 | @ <a href="%R/artifact/%!S(zSrc)"%s(zLinkTgt)>%h(zFile)</a> |
| 829 | if( flags & ATTACHLIST_SIZE ){ |
| 830 | const int sz = db_int(0,"SELECT size FROM blob WHERE uuid=%Q", zSrc); |
| 831 |
+5
-2
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -33,12 +33,11 @@ | ||
| 33 | 33 | #define CFTYPE_CLUSTER 2 |
| 34 | 34 | #define CFTYPE_CONTROL 3 |
| 35 | 35 | #define CFTYPE_WIKI 4 |
| 36 | 36 | #define CFTYPE_TICKET 5 |
| 37 | 37 | #define CFTYPE_ATTACHMENT 6 |
| 38 | -#define CFTYPE_EVENT 7 /* older name for CFTYPE_TECHNOTE */ | |
| 39 | -#define CFTYPE_TECHNOTE 7 | |
| 38 | +#define CFTYPE_EVENT 7 | |
| 40 | 39 | #define CFTYPE_FORUM 8 |
| 41 | 40 | |
| 42 | 41 | /* |
| 43 | 42 | ** File permissions used by Fossil internally. |
| 44 | 43 | */ |
| @@ -2649,10 +2648,14 @@ | ||
| 2649 | 2648 | p->zAttachTarget, p->zAttachName, |
| 2650 | 2649 | p->zAttachTarget, p->zAttachName |
| 2651 | 2650 | ); |
| 2652 | 2651 | switch( attachment_target_type(p->zAttachTarget) ){ |
| 2653 | 2652 | case 0: |
| 2653 | + /* It is possible that p->zAttachTarget is not yet in this | |
| 2654 | + ** copy of the repository. If we cannot identify it yet, | |
| 2655 | + ** generate a generic /artifact link to it instead of a | |
| 2656 | + ** type-specific link or an error message. */ | |
| 2654 | 2657 | attachToType = 'a'; |
| 2655 | 2658 | if( isAdd ){ |
| 2656 | 2659 | zComment = mprintf( |
| 2657 | 2660 | "Add attachment [/artifact/%!S|%h] to [/artifact/%!S|%h]", |
| 2658 | 2661 | p->zAttachSrc, p->zAttachName, |
| 2659 | 2662 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -33,12 +33,11 @@ | |
| 33 | #define CFTYPE_CLUSTER 2 |
| 34 | #define CFTYPE_CONTROL 3 |
| 35 | #define CFTYPE_WIKI 4 |
| 36 | #define CFTYPE_TICKET 5 |
| 37 | #define CFTYPE_ATTACHMENT 6 |
| 38 | #define CFTYPE_EVENT 7 /* older name for CFTYPE_TECHNOTE */ |
| 39 | #define CFTYPE_TECHNOTE 7 |
| 40 | #define CFTYPE_FORUM 8 |
| 41 | |
| 42 | /* |
| 43 | ** File permissions used by Fossil internally. |
| 44 | */ |
| @@ -2649,10 +2648,14 @@ | |
| 2649 | p->zAttachTarget, p->zAttachName, |
| 2650 | p->zAttachTarget, p->zAttachName |
| 2651 | ); |
| 2652 | switch( attachment_target_type(p->zAttachTarget) ){ |
| 2653 | case 0: |
| 2654 | attachToType = 'a'; |
| 2655 | if( isAdd ){ |
| 2656 | zComment = mprintf( |
| 2657 | "Add attachment [/artifact/%!S|%h] to [/artifact/%!S|%h]", |
| 2658 | p->zAttachSrc, p->zAttachName, |
| 2659 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -33,12 +33,11 @@ | |
| 33 | #define CFTYPE_CLUSTER 2 |
| 34 | #define CFTYPE_CONTROL 3 |
| 35 | #define CFTYPE_WIKI 4 |
| 36 | #define CFTYPE_TICKET 5 |
| 37 | #define CFTYPE_ATTACHMENT 6 |
| 38 | #define CFTYPE_EVENT 7 |
| 39 | #define CFTYPE_FORUM 8 |
| 40 | |
| 41 | /* |
| 42 | ** File permissions used by Fossil internally. |
| 43 | */ |
| @@ -2649,10 +2648,14 @@ | |
| 2648 | p->zAttachTarget, p->zAttachName, |
| 2649 | p->zAttachTarget, p->zAttachName |
| 2650 | ); |
| 2651 | switch( attachment_target_type(p->zAttachTarget) ){ |
| 2652 | case 0: |
| 2653 | /* It is possible that p->zAttachTarget is not yet in this |
| 2654 | ** copy of the repository. If we cannot identify it yet, |
| 2655 | ** generate a generic /artifact link to it instead of a |
| 2656 | ** type-specific link or an error message. */ |
| 2657 | attachToType = 'a'; |
| 2658 | if( isAdd ){ |
| 2659 | zComment = mprintf( |
| 2660 | "Add attachment [/artifact/%!S|%h] to [/artifact/%!S|%h]", |
| 2661 | p->zAttachSrc, p->zAttachName, |
| 2662 |