🐛 Fix hash bug

This commit is contained in:
LittleSheep 2024-11-03 11:40:21 +08:00
parent 3f9df23491
commit 4223eb6ecd
2 changed files with 5 additions and 16 deletions

View File

@ -4,20 +4,9 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":wastebasket: Remove account"> <list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Bug fixes">
<change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources/bac83d8a-c619-4680-a07f-6674b93fbfea.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/bac83d8a-c619-4680-a07f-6674b93fbfea.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/dataSources/bac83d8a-c619-4680-a07f-6674b93fbfea/storage_v2/_src_/database/hy_paperclip.LrVPOQ/schema/public.abK9xQ.meta" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/bac83d8a-c619-4680-a07f-6674b93fbfea/storage_v2/_src_/database/hy_paperclip.LrVPOQ/schema/public.abK9xQ.meta" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/gap/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/gap/server.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/internal/services/analyzer.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/analyzer.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/attachments_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/attachments_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/pools_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/pools_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/sticker_packs_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/sticker_packs_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/stickers_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/stickers_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/up_direct_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/up_direct_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/up_multipart_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/up_multipart_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/attachments.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/attachments.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/sticker_packs.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/sticker_packs.go" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -129,7 +118,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value=":bug: Fix sql statement" />
<MESSAGE value=":bug: Fix doesn't get has lifecycle settings buckets correctly" /> <MESSAGE value=":bug: Fix doesn't get has lifecycle settings buckets correctly" />
<MESSAGE value=":zap: Fix the RandString method cause the lag" /> <MESSAGE value=":zap: Fix the RandString method cause the lag" />
<MESSAGE value=":bug: Fix mark clean required issue" /> <MESSAGE value=":bug: Fix mark clean required issue" />
@ -154,7 +142,8 @@
<MESSAGE value=":bug: Fix bug crash caused by hash small files" /> <MESSAGE value=":bug: Fix bug crash caused by hash small files" />
<MESSAGE value=":recycle: Migrated to nexus" /> <MESSAGE value=":recycle: Migrated to nexus" />
<MESSAGE value=":wastebasket: Remove account" /> <MESSAGE value=":wastebasket: Remove account" />
<option name="LAST_COMMIT_MESSAGE" value=":wastebasket: Remove account" /> <MESSAGE value=":bug: Bug fixes" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Bug fixes" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -277,7 +277,7 @@ func HashAttachment(file models.Attachment) (hash string, err error) {
hasher := sha256.New() hasher := sha256.New()
if chunkSize*3 <= fileInfo.Size() { if chunkSize*3 > fileInfo.Size() {
// If the total size is smaller than three chunks, then hash the whole file // If the total size is smaller than three chunks, then hash the whole file
buf := make([]byte, fileInfo.Size()) buf := make([]byte, fileInfo.Size())
if _, err := inFile.Read(buf); err != nil && err != io.EOF { if _, err := inFile.Read(buf); err != nil && err != io.EOF {