| | @@ -1560,16 +1560,43 @@ |
| 1560 | 1560 | @ <blockquote><pre> |
| 1561 | 1561 | hexdump(&content); |
| 1562 | 1562 | @ </pre></blockquote> |
| 1563 | 1563 | style_footer(); |
| 1564 | 1564 | } |
| 1565 | + |
| 1566 | +/* |
| 1567 | +** Attempt to lookup the specified checkin and file name into an rid. |
| 1568 | +*/ |
| 1569 | +int artifact_from_ci_and_filename( |
| 1570 | + const char *zCI, |
| 1571 | + const char *zFilename |
| 1572 | +){ |
| 1573 | + int cirid; |
| 1574 | + Manifest *pManifest; |
| 1575 | + ManifestFile *pFile; |
| 1576 | + |
| 1577 | + if( zCI==0 ) return 0; |
| 1578 | + if( zFilename==0 ) return 0; |
| 1579 | + cirid = name_to_rid(zCI); |
| 1580 | + pManifest = manifest_get(cirid, CFTYPE_MANIFEST, 0); |
| 1581 | + if( pManifest==0 ) return 0; |
| 1582 | + manifest_file_rewind(pManifest); |
| 1583 | + while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 1584 | + if( fossil_strcmp(zFilename, pFile->zName)==0 ){ |
| 1585 | + int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid); |
| 1586 | + manifest_destroy(pManifest); |
| 1587 | + return rid; |
| 1588 | + } |
| 1589 | + } |
| 1590 | + return 0; |
| 1591 | +} |
| 1565 | 1592 | |
| 1566 | 1593 | /* |
| 1567 | 1594 | ** Look for "ci" and "filename" query parameters. If found, try to |
| 1568 | 1595 | ** use them to extract the record ID of an artifact for the file. |
| 1569 | 1596 | */ |
| 1570 | | -int artifact_from_ci_and_filename(void){ |
| 1597 | +int artifact_from_ci_and_filename_www(void){ |
| 1571 | 1598 | const char *zFilename; |
| 1572 | 1599 | const char *zCI; |
| 1573 | 1600 | int cirid; |
| 1574 | 1601 | Manifest *pManifest; |
| 1575 | 1602 | ManifestFile *pFile; |
| | @@ -1673,11 +1700,11 @@ |
| 1673 | 1700 | int objType; |
| 1674 | 1701 | int asText; |
| 1675 | 1702 | const char *zUuid; |
| 1676 | 1703 | |
| 1677 | 1704 | if( P("ci") && P("filename") ){ |
| 1678 | | - rid = artifact_from_ci_and_filename(); |
| 1705 | + rid = artifact_from_ci_and_filename_www(); |
| 1679 | 1706 | } |
| 1680 | 1707 | if( rid==0 ){ |
| 1681 | 1708 | rid = name_to_rid_www("name"); |
| 1682 | 1709 | } |
| 1683 | 1710 | |
| 1684 | 1711 | |