-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(appstore): Add MD5 Checksum for Custom Application Store Packages #7629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ package files | |
|
|
||
| import ( | ||
| "bytes" | ||
| "crypto/md5" | ||
| "encoding/hex" | ||
| "errors" | ||
| "fmt" | ||
| "io" | ||
|
|
@@ -169,3 +171,17 @@ func Stat(path string) bool { | |
| } | ||
| return true | ||
| } | ||
|
|
||
| func GetFileMD5(filePath string) (string, error) { | ||
| file, err := os.Open(filePath) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| defer file.Close() | ||
| hash := md5.New() | ||
|
|
||
| if _, err = io.Copy(hash, file); err != nil { | ||
| return "", err | ||
| } | ||
| return hex.EncodeToString(hash.Sum(nil)), nil | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The given code seems to be correct and there are no apparent issues. However, it's worth mentioning that the Additionally, consider refactoring your imports if necessary to ensure proper version compatibility and reduce clutter. Here are some suggestions:
Remember that these changes would affect future code versions when merging new commits into production branches. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but you've shared a snippet of PHP code which isn't clear enough to analyze the differences between the two versions that you're contrasting it against your version. Could you please share more details on the current application context or additional information about the specific lines/diagrams being shown? That would help me accurately assess what parts need improvement or clarification.