Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

S3PostUploadSignedPolicy.addTokenToPolicy throws uncaught exception on Windows #117

Closed
PLockhart opened this issue Jan 18, 2016 · 5 comments

Comments

@PLockhart
Copy link

Thrown here

My policy is the following:
{"expiration": "2016-07-22T14:37:19Z","conditions": [{"bucket": "testify-development"},["starts-with", "$key", "10\53\238\571.mp4"],{"acl": "public-read"},["eq", "$Content-Type", "video/mp4"]]}

The exception does not get thrown on OSX. Tested on a Windows 10 64 bit machine.

@PLockhart
Copy link
Author

When I surround in a try catch I get the following callstack:

AWS Policy parsing exception ThirdParty.Json.LitJson.JsonException: Invalid character '5' in input string
at ThirdParty.Json.LitJson.Lexer.NextToken () [0x0002c] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Core\ThirdParty\Json\Lexer.cs:884
at ThirdParty.Json.LitJson.JsonReader.ReadToken () [0x0000d] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Core\ThirdParty\Json\JsonReader.cs:231
at ThirdParty.Json.LitJson.JsonReader.Read () [0x0029a] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Core\ThirdParty\Json\JsonReader.cs:352
at ThirdParty.Json.LitJson.JsonMapper.ReadValue (ThirdParty.Json.LitJson.WrapperFactory factory, ThirdParty.Json.LitJson.JsonReader reader) [0x00000] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Core\ThirdParty\Json\JsonMapper.cs:490
at ThirdParty.Json.LitJson.JsonMapper.ReadValue (ThirdParty.Json.LitJson.WrapperFactory factory, ThirdParty.Json.LitJson.JsonReader reader) [0x000d9] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Core\ThirdParty\Json\JsonMapper.cs:527
at ThirdParty.Json.LitJson.JsonMapper.ReadValue (ThirdParty.Json.LitJson.WrapperFactory factory, ThirdParty.Json.LitJson.JsonReader reader) [0x000d9] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Core\ThirdParty\Json\JsonMapper.cs:527
at ThirdParty.Json.LitJson.JsonMapper.ReadValue (ThirdParty.Json.LitJson.WrapperFactory factory, ThirdParty.Json.LitJson.JsonReader reader) [0x00141] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Core\ThirdParty\Json\JsonMapper.cs:548
at ThirdParty.Json.LitJson.JsonMapper.ToWrapper (ThirdParty.Json.LitJson.WrapperFactory factory, ThirdParty.Json.LitJson.JsonReader reader) [0x00000] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Core\ThirdParty\Json\JsonMapper.cs:914
at ThirdParty.Json.LitJson.JsonMapper.ToObject (ThirdParty.Json.LitJson.JsonReader reader) [0x00000] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Core\ThirdParty\Json\JsonMapper.cs:874
at Amazon.S3.Util.S3PostUploadSignedPolicy.addTokenToPolicy (System.String policy, System.String token) [0x00000] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Services\S3\Custom\Util_bcl\S3PostUploadSignedPolicy.cs:87
at Amazon.S3.Util.S3PostUploadSignedPolicy.GetSignedPolicy (System.String policy, Amazon.Runtime.AWSCredentials credentials) [0x0001c] in E:\Github\user-testing-plugin-tool\Assets\AWSSDK\src\Services\S3\Custom\Util_bcl\S3PostUploadSignedPolicy.cs:62

@karthiksaligrama
Copy link
Contributor

You JSON in policy is not correctly formed. You need to escape the characters.

{"expiration": "2016-07-22T14:37:19Z","conditions": [{"bucket": "testify-development"},["starts-with", "$key", "10\\53\\238\\571.mp4"],{"acl": "public-read"},["eq", "$Content-Type", "video/mp4"]]}

@PLockhart
Copy link
Author

Ok thanks, I will check this out in the morning. Why might it work on platforms other than windows though? I don't see any platform dependent code in the json parser.

@jdmiranda
Copy link

windows and linux environments don't escape all characters the same.
On Mon, Jan 18, 2016 at 13:19 Peter Lockhart notifications@github.com
wrote:

Ok thanks, I will check this out in the morning. Why might it work on
platforms other than windows though? I don't see any platform dependent
code in the json parser.


Reply to this email directly or view it on GitHub
#117 (comment).

@PLockhart
Copy link
Author

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants