Skip to content

Commit

Permalink
refactor: Optimize file decryption process and handle empty password …
Browse files Browse the repository at this point in the history
…case
  • Loading branch information
itsfuad committed Jul 10, 2024
1 parent e1cb049 commit c0ec3a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions encryption/encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ func Decrypt(data *[]byte, password string) ([]byte, error) {
}

metadata := (*data)[0]
*data = (*data)[MetadataLength:]

if metadata == 0 {
// No password was used
return *data, nil
}

*data = (*data)[MetadataLength:]

if password == "" {
return nil, errors.New("password is required")
}
Expand Down
Binary file removed test/zip/compressed.bin
Binary file not shown.

0 comments on commit c0ec3a7

Please sign in to comment.