| | @@ -71,11 +71,12 @@ |
| 71 | 71 | ** If none are given, all attachments are listed. If one is given, only |
| 72 | 72 | ** attachments for the designated technote, ticket or wiki page are shown. |
| 73 | 73 | ** |
| 74 | 74 | ** HASH may be just a prefix of the relevant technical note or ticket |
| 75 | 75 | ** artifact hash, in which case all attachments of all technical notes or |
| 76 | | -** tickets with the prefix will be listed. |
| 76 | +** tickets with the prefix will be listed. Forum posts, on the other hand, |
| 77 | +** require a unique hash prefix. |
| 77 | 78 | */ |
| 78 | 79 | void attachlist_page(void){ |
| 79 | 80 | const char *zPage = P("page"); |
| 80 | 81 | const char *zTkt = P("tkt"); |
| 81 | 82 | const char *zTechNote = P("technote"); |
| | @@ -93,20 +94,18 @@ |
| 93 | 94 | " (SELECT uuid FROM blob WHERE rid=attachid), attachid" |
| 94 | 95 | " FROM attachment" |
| 95 | 96 | ); |
| 96 | 97 | if( zForumPost ){ |
| 97 | 98 | int fnid; |
| 98 | | - char *zUuid; |
| 99 | 99 | if( g.perm.RdForum==0 ){ login_needed(g.anon.RdForum); return; } |
| 100 | | - style_header("Attachments To %h", zForumPost); |
| 100 | + style_header("Attachments To Forum post %S", zForumPost); |
| 101 | 101 | fnid = forumpost_head_rid2(zForumPost); |
| 102 | 102 | if( fnid<=0 ){ |
| 103 | 103 | webpage_error("Invalid forum post ID: %h", zForumPost); |
| 104 | 104 | } |
| 105 | | - zUuid = rid_to_uuid(fnid); |
| 106 | | - blob_append_sql(&sql, " WHERE target=%Q", zUuid); |
| 107 | | - fossil_free(zUuid); |
| 105 | + blob_append_sql(&sql, " WHERE target=" |
| 106 | + "(SELECT uuid FROM blob WHERE rid=%d)", fnid); |
| 108 | 107 | }else if( zPage ){ |
| 109 | 108 | if( g.perm.RdWiki==0 ){ login_needed(g.anon.RdWiki); return; } |
| 110 | 109 | style_header("Attachments To Wiki page %h", zPage); |
| 111 | 110 | blob_append_sql(&sql, " WHERE target=%Q", zPage); |
| 112 | 111 | }else if( zTkt ){ |
| 113 | 112 | |