updated s3_key name to icon_hash
This commit is contained in:
parent
e308718eb2
commit
33bd0a221e
8 changed files with 31 additions and 31 deletions
|
|
@ -37,22 +37,22 @@ func processIcon(icon IconRow, cfg Config) DownloadResult {
|
|||
|
||||
// Compute SHA-256 for content-addressed storage
|
||||
hash := sha256.Sum256(data)
|
||||
s3Key := hex.EncodeToString(hash[:])
|
||||
iconHash := hex.EncodeToString(hash[:])
|
||||
|
||||
// Write to disk (skip if already exists — dedup)
|
||||
dedup := false
|
||||
if !cfg.DryRun {
|
||||
if iconExists(s3Key) {
|
||||
if iconExists(iconHash) {
|
||||
dedup = true
|
||||
} else {
|
||||
if err := iconWrite(s3Key, data); err != nil {
|
||||
if err := iconWrite(iconHash, data); err != nil {
|
||||
return DownloadResult{Err: fmt.Sprintf("disk write: %v", err), ErrType: "other"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return DownloadResult{
|
||||
S3Key: s3Key,
|
||||
IconHash: iconHash,
|
||||
ContentType: contentType,
|
||||
Width: width,
|
||||
Height: height,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue