Conversation
| return nil, "", err | ||
| } | ||
| if err := writer.Close(); err != nil { | ||
| log.Error("Failed to close writer", zap.Error(err)) |
Check warning
Code scanning / gosec
Errors unhandled.
| } | ||
| // addFilePart adds a file part to the multipart writer with the provided field name and file path. | ||
| func addFilePart(writer *multipart.Writer, fieldName, filePath string, contentTypes map[string]string, headersMap map[string]http.Header, log logger.Logger) error { | ||
| file, err := os.Open(filePath) |
Check failure
Code scanning / gosec
Potential file inclusion via variable
| return err | ||
| } | ||
| if _, err := fieldWriter.Write([]byte(val)); err != nil { | ||
| log.Error("Failed to write form field", zap.String("key", key), zap.Error(err)) |
Check warning
Code scanning / gosec
Errors unhandled.
| func addFormField(writer *multipart.Writer, key, val string, log logger.Logger) error { | ||
| fieldWriter, err := writer.CreatePart(FormDataHeader(key, "text/plain")) | ||
| if err != nil { | ||
| log.Error("Failed to create form field", zap.String("key", key), zap.Error(err)) |
Check warning
Code scanning / gosec
Errors unhandled.
|
|
||
| progressLogger := logUploadProgress(fileSize.Size(), log) | ||
| if err := chunkFileUpload(file, part, log, progressLogger); err != nil { | ||
| log.Error("Failed to copy file content", zap.String("filePath", filePath), zap.Error(err)) |
Check warning
Code scanning / gosec
Errors unhandled.
| return body, writer.FormDataContentType(), nil | ||
| fileSize, err := file.Stat() | ||
| if err != nil { | ||
| log.Error("Failed to get file info", zap.String("filePath", filePath), zap.Error(err)) |
Check warning
Code scanning / gosec
Errors unhandled.
| if err != nil { | ||
| log.Error("Failed to close writer", zap.Error(err)) | ||
| return nil, "", err | ||
| log.Error("Failed to create form file part", zap.String("fieldName", fieldName), zap.Error(err)) |
Check warning
Code scanning / gosec
Errors unhandled.
| func addFilePart(writer *multipart.Writer, fieldName, filePath string, contentTypes map[string]string, headersMap map[string]http.Header, log logger.Logger) error { | ||
| file, err := os.Open(filePath) | ||
| if err != nil { | ||
| log.Error("Failed to open file", zap.String("filePath", filePath), zap.Error(err)) |
Check warning
Code scanning / gosec
Errors unhandled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…nd headers
Change
Type of Change
Please DELETE options that are not relevant.
Checklist