Skip to content
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

"There was an error uploading the file to the server" #38

Closed
thomasmebes opened this issue May 8, 2016 · 5 comments
Closed

"There was an error uploading the file to the server" #38

thomasmebes opened this issue May 8, 2016 · 5 comments

Comments

@thomasmebes
Copy link

thomasmebes commented May 8, 2016

Hello!

I use your newest Version on my iPhone.

When I try to send an Image then I recieve follow message:
There was an error uploading the file to the server.
"The operation could not be completed. (JSON error 0.)"

However, the upload actually succeeds. That is, the file is stored on the server just fine:

2016-05-08 23:23:25.851 [debug] <0.486.0>@ejabberd_receiver:process_data:282 Received XML on stream = <<"photo.png97369image/png">>
2016-05-08 23:23:25.852 [debug] <0.487.0>@ejabberd_router:do_route:324 route
from {jid,<<"t.mebes">>,<<"kautbullinger.de">>,<<"Monal-iOS">>,<<"t.mebes">>,<<"kautbullinger.de">>,<<"Monal-iOS">>}
to {jid,<<>>,<<"xmpp.kautbullinger.de">>,<<>>,<<>>,<<"xmpp.kautbullinger.de">>,<<>>}
packet {xmlel,<<"iq">>,[{<<"id">>,<<"08E0BC57-B870-4416-80F8-64EA82A191C9">>},{<<"type">>,<<"get">>},{<<"to">>,<<"xmpp.kautbullinger.de">>}],[{xmlel,<<"request">>,[{<<"xmlns">>,<<"urn:xmpp:http:upload">>}],[{xmlel,<<"filename">>,[],[{xmlcdata,<<"photo.png">>}]},{xmlel,<<"size">>,[],[{xmlcdata,<<"97369">>}]},{xmlel,<<"content-type">>,[],[{xmlcdata,<<"image/png">>}]}]}]}
2016-05-08 23:23:25.853 [info] <0.396.0>@mod_http_upload:create_slot:622 Got HTTP upload slot for t.mebes@kautbullinger.de/Monal-iOS (file: photo.png)
2016-05-08 23:23:25.853 [debug] <0.396.0>@ejabberd_router:do_route:324 route
from {jid,<<>>,<<"xmpp.kautbullinger.de">>,<<>>,<<>>,<<"xmpp.kautbullinger.de">>,<<>>}
to {jid,<<"t.mebes">>,<<"kautbullinger.de">>,<<"Monal-iOS">>,<<"t.mebes">>,<<"kautbullinger.de">>,<<"Monal-iOS">>}
packet {xmlel,<<"iq">>,[{<<"id">>,<<"08E0BC57-B870-4416-80F8-64EA82A191C9">>},{<<"type">>,<<"result">>}],[{xmlel,<<"slot">>,[{<<"xmlns">>,<<"urn:xmpp:http:upload">>}],[{xmlel,<<"put">>,[],[{xmlcdata,<<"https://xmpp.kautbullinger.de:5443/31b9922be995aeb909d9e2a5b802013b4e401f0f/ACuCV9HvIr42UzKXTvDSlGfCwmNpUGGQcy0JYPYM/photo.png">>}]},{xmlel,<<"get">>,[],[{xmlcdata,<<"https://xmpp.kautbullinger.de:5443/31b9922be995aeb909d9e2a5b802013b4e401f0f/ACuCV9HvIr42UzKXTvDSlGfCwmNpUGGQcy0JYPYM/photo.png">>}]}]}]}
2016-05-08 23:23:25.854 [debug] <0.396.0>@ejabberd_local:do_route:260 local route
from {jid,<<>>,<<"xmpp.kautbullinger.de">>,<<>>,<<>>,<<"xmpp.kautbullinger.de">>,<<>>}
to {jid,<<"t.mebes">>,<<"kautbullinger.de">>,<<"Monal-iOS">>,<<"t.mebes">>,<<"kautbullinger.de">>,<<"Monal-iOS">>}
packet {xmlel,<<"iq">>,[{<<"id">>,<<"08E0"...>>},{<<"type">>,<<...>>}],[{xmlel,<<...>>,...}]}
2016-05-08 23:23:25.854 [debug] <0.396.0>@ejabberd_sm:do_route:411 session manager
from {jid,<<>>,<<"xmpp.kautbullinger.de">>,<<>>,<<>>,<<"xmpp.kautbullinger.de">>,<<>>}
to {jid,<<"t.mebes">>,<<"kautbullinger.de">>,<<"Monal-iOS">>,<<"t.mebes">>,<<"kautbullinger.de">>,<<"Monal-iOS">>}
packet {xmlel,<<"iq">>,[{<<"id">>,<<"08E0"...>>},{<<"type">>,<<...>>}],[{xmlel,<<...>>,...}]}
2016-05-08 23:23:25.854 [debug] <0.396.0>@ejabberd_sm:do_route:529 sending to process <0.487.0>
2016-05-08 23:23:25.854 [debug] <0.487.0>@ejabberd_c2s:send_text:1838 Send XML on stream = <<"https://xmpp.kautbullinger.de:5443/31b9922be995aeb909d9e2a5b802013b4e401f0f/ACuCV9HvIr42UzKXTvDSlGfCwmNpUGGQcy0JYPYM/photo.pnghttps://xmpp.kautbullinger.de:5443/31b9922be995aeb909d9e2a5b802013b4e401f0f/ACuCV9HvIr42UzKXTvDSlGfCwmNpUGGQcy0JYPYM/photo.png">>
2016-05-08 23:23:25.854 [debug] <0.487.0>@ejabberd_c2s:send_text:1838 Send XML on stream = <<"">>
2016-05-08 23:23:25.889 [debug] <0.486.0>@ejabberd_receiver:process_data:282 Received XML on stream = <<"">>
2016-05-08 23:23:25.889 [debug] <0.487.0>@ejabberd_c2s:check_h_attribute:2756 t.mebes@kautbullinger.de/Monal-iOS acknowledged 199 of 199 stanzas
2016-05-08 23:23:25.966 [info] <0.476.0>@ejabberd_listener🉑333 (#Port<0.9021>) Accepted connection 188.195.202.55:49700 -> 144.76.108.84:5443
2016-05-08 23:23:25.966 [debug] <0.653.0>@ejabberd_http:init:154 S: [{[],mod_http_upload}]
2016-05-08 23:23:25.966 [info] <0.653.0>@ejabberd_http:init:158 started: {p1_tls,{tlssock,#Port<0.9021>,#Port<0.9022>}}
2016-05-08 23:23:26.043 [debug] <0.653.0>@ejabberd_http:process_header:281 ({tlssock,#Port<0.9021>,#Port<0.9022>}) http query: 'PUT' <<"/31b9922be995aeb909d9e2a5b802013b4e401f0f/ACuCV9HvIr42UzKXTvDSlGfCwmNpUGGQcy0JYPYM/photo.png">>
2016-05-08 23:23:26.395 [debug] <0.653.0>@ejabberd_http:extract_path_query:395 client data: <<255,216,255,224,0,16,74,70,73,70,0,1,1,0,0,72,0,72,0,0,255,225,0,88,69,120,105,102,0,0,77,77,0,42,0,0,0,8,0,2,1,18,0,3,0,0,0,1,0,1,0,0,135,105,0,4,0,0,0,1,0,0,0,38,0,0,0,0,0,3,160,1,0,3,0,0,0,1,0,1,0,0,160,2,0,4,0,0,0,1,0,0,4,56,160,3,0,4,0,0,0,1,0,0,5,160,0,0,0,0,255,237,0,56,80,104,111,116,111,115,104,111,112,32,51,46,48,0,56,66,73,77,4,4,0,0,0,0,0,0,56,66,73,77,4,37,0,0,0,0,0,16,212,29,140,217,143,0,178,4,233,128,9,152,236,248,66,126,255,192,0,17,8,5,160,4,56,3,1,34,0,2,17,1,3,17,1,255,196,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,255,196,0,181,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250,255,196,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,255,196,0,181,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250,255,219,0,67,0,6,6,6,6,6,6,10,6,6,10,14,10,10,10,14,18,14,14,14,14,18,23,18,18,18,18,18,23,28,23,23,23,23,23,23,28,28,28,28,28,28,28,28,34,34,34,34,34,34,39,39,39,39,39,44,44,44,44,44,44,44,44,44,44,255,219,0,67,1,7,7,7,11,10,11,19,10,10,19,46,31,26,31,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,255,221,0,4,0,68,255,218,0,12,3,1,0,2,17,3,17,0,63,0,224,155,130,72,164,32,55,81,75,140,31,173,46,112,113,235,94,106,61,1,50,65,221,78,11,135,56,60,63,52,208,62,108,30,212,226,126,64,127,186,113,76,16,15,238,210,241,140,119,233,74,220,55,31,90,58,179,99,235,64,198,231,3,62,135,20,225,212,143,81,64,25,6,148,245,4,82,98,232,10,8,199,177,165,3,5,151,214,151,25,39,29,168,28,55,52,12,110,1,108,250,83,199,63,47,99,77,244,62,156,83,184,7,30,212,172,47,33,48,63,42,92,99,159,206,148,14,55,83,135,181,48,176,157,57,160,115,143,74,92,14,221,233,72,249,104,24,99,4,138,7,34,142,113,75,208,140,126,52,3,97,159,78,180,171,70,51,211,181,41,192,52,2,14,7,227,75,142,40,199,173,56,12,53,1,96,94,126,97,75,142,73,160,112,48,59,82,143,122,6,59,173,59,29,168,3,35,138,112,28,86,76,208,57,234,189,106,80,58,83,71,74,80,77,34,111,212,145,121,233,78,92,146,72,166,175,45,79,0,10,76,161,224,14,49,82,99,158,42,48,49,129,235,83,40,192,169,91,13,48,198,71,210,148,12,245,163,105,60,103,21,40,28,147,76,104,98,131,143,175,20,253,128,156,154,120,90,85,24,24,245,169,99,19,28,99,181,38,59,10,118,56,38,140,109,226,149,187,12,69,24,20,184,231,154,82,78,115,218,151,25,34,172,87,27,215,232,40,35,140,158,148,236,100,226,151,177,247,160,99,6,50,61,105,49,129,239,79,28,100,158,77,37,0,8,112,106,85,60,113,81,99,61,41,200,196,12,118,168,104,104,148,102,156,58,83,1,28,131,79,199,106,144,72,127,25,200,230,144,30,13,52,30,40,83,142,180,139,20,12,29,213,32,112,72,245,53,25,35,28,26,140,182,198,201,233,78,196,108,91,36,99,154,96,97,142,79,74,170,215,0,244,170,210,78,138,55,59,113,77,71,160,156,139,198,101,199,203,200,168,30,108,13,204,112,43,30,107,253,160,136,240,69,100,203,123,151,234,121,173,99,77,178,37,82,198,244,151,241,39,3,154,161,46,162,221,176,43,13,238,51,201,250,213,41,46,149,120,39,21,...>>
2016-05-08 23:23:26.395 [debug] <0.653.0>@ejabberd_http:process:353 [<<"31b9922be995aeb909d9e2a5b802013b4e401f0f">>,<<"ACuCV9HvIr42UzKXTvDSlGfCwmNpUGGQcy0JYPYM">>,<<"photo.png">>] matches []
2016-05-08 23:23:26.395 [debug] <0.653.0>@mod_http_upload:process:409 Storing file from 188.195.202.55 for xmpp.kautbullinger.de: /var/lib/ejabberd/upload/31b9922be995aeb909d9e2a5b802013b4e401f0f/ACuCV9HvIr42UzKXTvDSlGfCwmNpUGGQcy0JYPYM/photo.png

Can you fix this problem?

Thank you very much!

@weiss
Copy link

weiss commented Jun 26, 2016

When I try to send an Image then I recieve follow message:
There was an error uploading the file to the server.
"The operation could not be completed. (JSON error 0.)"

However, the upload actually succeeds. That is, the file is stored on the server just fine

FWIW, I can reproduce this using ejabberd's mod_http_upload (which I wrote, so if there's anything I can do to help debug the issue, just let me know).

I can only reproduce this on two of three servers I tried, though. E.g., it fails on conversations.im, but it works just fine with jabber.at. These servers all use the same mod_http_upload version, the only difference I see is that jabber.at uses Apache instead of Nginx to proxy the PUT request.

@weiss
Copy link

weiss commented Jun 27, 2016

I tracked it down: Monal obviously stumbles over the body of the PUT response. I get the error message both with a text/plain body (which ejabberd returns) and with a text/html body. The upload works fine if the body of the PUT response is either empty or contains valid JSON syntax.

@anurodhp
Copy link
Contributor

Oh thanks. I hadn't taken a look at this yet, but will adjust it. It should be a quick fix.

Anurodh Pokharel

Sent from my iPhone

On Jun 27, 2016, at 7:15 AM, Holger Weiß notifications@github.com wrote:

I tracked it down: Monal obviously stumbles over the body of the PUT response. I get the error message both with a text/plain body (which ejabberd returns) and with a text/html body. The upload works fine if the body of the PUT response is either empty or contains valid JSON syntax.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@mathiasertl
Copy link

For the record (Note: I run jabber.at), an empty string is not valid JSON, as far as I am aware. My django-xmpp-http-upload, which we use for the HTTP component of XEP-0363, never returns JSON for PUT requests, and neither does it indicate that in the Content-Type header. I assume this is the difference to conversations.im. (and monal should obviously take a hint from the Content-Type header returned in the response)

@weiss
Copy link

weiss commented Jun 27, 2016

an empty string is not valid JSON, as far as I am aware. My django-xmpp-http-upload, which we use for the HTTP component of XEP-0363, never returns JSON for PUT requests, and neither does it indicate that in the Content-Type header. I assume this is the difference to conversations.im.

The difference is that jabber.at returns an empty body, while conversations.im returns a text/plain body. Monal currently accepts either an empty body or JSON data, and I think it should instead just ignore any body for the PUT responses of HTTP uploads.

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

No branches or pull requests

4 participants