-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
timob-7850: Convert fileType Number input to integer before processing it #1610
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 |
---|---|---|
|
@@ -103,7 +103,7 @@ public static TiBlob blobFromImage(Bitmap image) | |
data = bos.toByteArray(); | ||
} | ||
|
||
TiBlob blob = new TiBlob(TYPE_IMAGE, data, "image/bitmap"); | ||
TiBlob blob = new TiBlob(TYPE_IMAGE, data, "image/png"); | ||
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. How can we assume that image/png is the right mimeType? There are several different image types, PNG is only one 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. It seems that we're trying to convert this to png. But it could be in a different format if it can't be converted. I'll fix this. Thanks |
||
blob.width = image.getWidth(); | ||
blob.height = image.getHeight(); | ||
return blob; | ||
|
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.
What if the value is a string like the comment mentions?
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.
its fine if its a string, since this int will be converted to string anyways. The problem that caused this was when the user enter "fileType: 2". We recognized that "2" as a Double, so when we convert it to String, it becomes 2.0, which is an invalid fileType. So a String that is "2.0" would NOT work.
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 fix is to mainly address the issue when user types an int in JS, like "2", for fileType, we recognize that as a Double, while he/she thinks that this will be an integer.
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.
Why are we even checking for
fileType
here?fileType
isn't a standard property, it is specific to the bug in the test caseThere 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.
Hmm, you're right. I thought it was but this is user input, which means it should've worked in the first place. I just tested it on my phone and the original test case works... It wasn't working before. Something weird is going on. I'll investigate further on Sunday. Thanks for pointing this out.
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.
The point is, the change in place does not handle:
: "123"
because the value passed to the send() method on the java side see the value as java.lang.String and thus will never pass a instanceof check.
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.
@hieupham007 when you investigate, if you can reproduce failure against master can you please attach the logcat output to the Jira ticket for reference?