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
Open()'ing binary files and multipart uploads #524
Conversation
…part file with diff content-type
@spicykoala Here's the new PR :) I feel it's more or less ready to be merged but if you can give me feedback and/or test this PR that'd be great. @na-- If you have any feedback on this PR I'd appreciate it as well. |
ContentType string | ||
} | ||
|
||
var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"") |
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.
This escaping seems a bit strange. I think it's equivalent to strings.NewReplacer(`\`, `\\`, `"`, `\"`)
, but much harder to understand because of the mixed quotes. Also probably deserves a simple unit test just in case.
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.
Taking my words back since this is basically copied from https://golang.org/src/mime/multipart/writer.go?s=2899:3037#L126
js/modules/k6/http/file.go
Outdated
fname, ct := fmt.Sprintf("%d", time.Now().UnixNano()), "application/octet-stream" | ||
|
||
if len(args) > 0 { | ||
fname = escapeQuotes(args[0]) |
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.
These strings should probably be escaped in the context they are used (line 124-125), not in the FileData
struct "constructor"
Codecov Report
@@ Coverage Diff @@
## master #524 +/- ##
==========================================
- Coverage 62.86% 62.66% -0.21%
==========================================
Files 95 94 -1
Lines 6962 6835 -127
==========================================
- Hits 4377 4283 -94
+ Misses 2339 2302 -37
- Partials 246 250 +4
Continue to review full report at Codecov.
|
This a continuation of #420 (also overriding #370).
It implements support for
open()
ing binary files and multipart uploads with the following API: