Sending file containing spaces generates 404 errors with prosody http_upload module
Please first check if another issue has been opened for your problem
Versions
- OS: Client: Arch Linux 4.18.14-arch1-1-ARCH x86_64, Server: 4.18.14-1-ARCH aarch64
- Gajim: 1.0.3
- GTK+ Version: 3.24.1
- Version de PyGObject : 3.30.1
- Python-nbxmpp version: 0.6.8
- Prosody 0.10.2 server with mod_http_upload enabled
- Android 8.1 on OnePlus 3T with Conversations 2.3.2
Steps to reproduce the problem
- Using Gajim client, send an attachment which name contains space characters
- The recipient (using Conversations or Gajim or ) can not open the file
- Accessing the file with the given URL leads to a 404 error.
Expected behavior
Recipient should be able to open the uploaded file.
Actual behavior
The generated URL is this:
aesgcm://my.server.com:5281/upload/4BULNeM7kyqwJS_N/test%2520send%2520gajim.png#c10f084bd4600f64db3d2f50668309fdfb1df1ca5f591fe54f2d297ceb07d1a21e933b5258cf19353fca566a1a63df1c
You can see that spaces has become %2520 in the URL.
The filename in the filesystem is /var/lib/prosody/http_upload/4BULNeM7kyqwJS_N/test%20send%20gajim.png
You can see that spaces are written with %0.12.3.
When Conversations is used to send the file, everything works fine. The filename in the filesystem is quoted and spaces are kept as spaces like for exemple this one:
/var/lib/prosody/http_upload/xlfe394LZtAEsL2D/'test send gajim.png'
In this case, gajim receives it correctly, also the file is accessible with a web browser (no 404 error).
This is the logs where you can see the upload action and the download error (I replaced my server name with my.server.com and the IP with 99.99.99.99):
Oct 17 11:30:20 server prosody[10907]: c2saaaaeaf52380: #queue = 0
Oct 17 11:31:17 server prosody[10907]: socket: server.lua: client 99.99.99.99:43313 read error: closed
Oct 17 11:31:17 server prosody[10907]: socket: server.lua: closed client handler and removed socket from list
Oct 17 11:31:17 server prosody[10907]: socket: server.lua: client 99.99.99.99:43312 read error: closed
Oct 17 11:31:17 server prosody[10907]: socket: server.lua: closed client handler and removed socket from list
Oct 17 11:32:10 server prosody[10907]: c2saaaaeaf52380: Handled 102 incoming stanzas
Oct 17 11:32:10 server prosody[10907]: c2saaaaeaf52380: Received[c2s]: <iq id='1302175b-607d-497d-9eab-8ce29a202be1' type='get' to='my.server.com' from='bertrand@my.server.com/gajim.JIXDJVOK'>
Oct 17 11:32:10 server prosody[10907]: c2saaaaeaf52380: Given upload slot "4BULNeM7kyqwJS_N/test%20send%20gajim.png"
Oct 17 11:32:10 server prosody[10907]: c2saaaaeaf52380: #queue = 1
Oct 17 11:32:10 server prosody[10907]: c2saaaaeaf52380: Queuing <r> (in a moment)
Oct 17 11:32:10 server prosody[10907]: c2saaaaeaf52380: Sending <r> (inside timer, before send)
Oct 17 11:32:10 server prosody[10907]: c2saaaaeaf52380: Sending <r> (inside timer, after send)
Oct 17 11:32:10 server prosody[10907]: c2saaaaeaf52380: Received[c2s]: <r xmlns='urn:xmpp:sm:3'>
Oct 17 11:32:10 server prosody[10907]: my.server.com:smacks: Received ack request, acking for 102
Oct 17 11:32:11 server prosody[10907]: c2saaaaeaf52380: Received[c2s]: <a xmlns='urn:xmpp:sm:3' h='153'>
Oct 17 11:32:11 server prosody[10907]: c2saaaaeaf52380: #queue = 0
Oct 17 11:32:11 server prosody[10907]: socket: server.lua: auto-starting ssl negotiation...
Oct 17 11:32:11 server prosody[10907]: socket: server.lua: attempting to start tls on tcp{client}: 0xaaaaeb54ac28
Oct 17 11:32:11 server prosody[10907]: socket: server.lua: accepted new client connection from 99.99.99.99:44556 to 5281
Oct 17 11:32:11 server prosody[10907]: socket: server.lua: ssl handshake done
Oct 17 11:32:11 server prosody[10907]: http.server: Firing event: PUT my.server.com/upload/4BULNeM7kyqwJS_N/test%20send%20gajim.png
Oct 17 11:32:11 server prosody[10907]: my.server.com:http_upload: File uploaded by bertrand@my.server.com/gajim.JIXDJVOK to slot 4BULNeM7kyqwJS_N
Oct 17 11:32:11 server prosody[10907]: socket: server.lua: closed client handler and removed socket from list
Oct 17 11:32:11 server prosody[10907]: c2saaaaeaf52380: Handled 103 incoming stanzas
Oct 17 11:32:11 server prosody[10907]: c2saaaaeaf52380: Received[c2s]: <message id='09224162-d751-436f-a9e2-3d5480a14ec8' type='chat' to='virginie@my.server.com/Conversations.XymN' from='bertrand@my.server.com/gajim.JIXDJVOK'>
Oct 17 11:32:11 server prosody[10907]: my.server.com:carbons: Sending carbon to bertrand@my.server.com/Conversations.VuSP
Oct 17 11:32:11 server prosody[10907]: c2saaaaeb15f6c0: #queue = 1
Oct 17 11:32:11 server prosody[10907]: c2saaaaeb15f6c0: Queuing <r> (in a moment)
Oct 17 11:32:11 server prosody[10907]: sql: SQL transaction begin [function(mod_storage_sql.lua:57)]
Oct 17 11:32:11 server prosody[10907]: sql: SQL transaction success [function(mod_storage_sql.lua:57)]
Oct 17 11:32:11 server prosody[10907]: my.server.com:mam: bertrand's rule for virginie@my.server.com is nil
Oct 17 11:32:11 server prosody[10907]: my.server.com:mam: bertrand's default rule is true
Oct 17 11:32:11 server prosody[10907]: c2saaaaeaf52380: Archiving stanza: <message id='09224162-d751-436f-a9e2-3d5480a14ec8' type='chat' to='virginie@my.server.com/Conversations.XymN' from='bertrand@my.server.com/gajim.JIXDJVOK'>
Oct 17 11:32:11 server prosody[10907]: sql: SQL transaction begin [function(mod_storage_sql.lua:228)]
Oct 17 11:32:11 server prosody[10907]: sql: SQL transaction success [function(mod_storage_sql.lua:228)]
Oct 17 11:32:11 server prosody[10907]: sql: SQL transaction begin [function(mod_storage_sql.lua:57)]
Oct 17 11:32:11 server prosody[10907]: sql: SQL transaction success [function(mod_storage_sql.lua:57)]
Oct 17 11:32:11 server prosody[10907]: my.server.com:mam: virginie's rule for bertrand@my.server.com is nil
Oct 17 11:32:11 server prosody[10907]: my.server.com:mam: virginie's default rule is true
Oct 17 11:32:11 server prosody[10907]: my.server.com:mam: Archiving stanza: <message id='09224162-d751-436f-a9e2-3d5480a14ec8' type='chat' to='virginie@my.server.com/Conversations.XymN' from='bertrand@my.server.com/gajim.JIXDJVOK'>
Oct 17 11:32:11 server prosody[10907]: sql: SQL transaction begin [function(mod_storage_sql.lua:228)]
Oct 17 11:32:11 server prosody[10907]: sql: SQL transaction success [function(mod_storage_sql.lua:228)]
Oct 17 11:32:11 server prosody[10907]: c2saaaaeb3fbbd0: #queue = 1
Oct 17 11:32:11 server prosody[10907]: c2saaaaeb3fbbd0: Queuing <r> (in a moment)
Oct 17 11:32:11 server prosody[10907]: c2saaaaeaf52380: Received[c2s]: <r xmlns='urn:xmpp:sm:3'>
Oct 17 11:32:11 server prosody[10907]: my.server.com:smacks: Received ack request, acking for 103
Oct 17 11:32:11 server prosody[10907]: c2saaaaeb15f6c0: Sending <r> (inside timer, before send)
Oct 17 11:32:11 server prosody[10907]: c2saaaaeb15f6c0: Sending <r> (inside timer, after send)
Oct 17 11:32:11 server prosody[10907]: c2saaaaeb3fbbd0: Sending <r> (inside timer, before send)
Oct 17 11:32:11 server prosody[10907]: c2saaaaeb3fbbd0: Sending <r> (inside timer, after send)
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb15f6c0: Received[c2s]: <a xmlns='urn:xmpp:sm:3' h='90'>
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb15f6c0: #queue = 0
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb3fbbd0: Handled 13 incoming stanzas
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb3fbbd0: Received[c2s]: <message type='chat' to='bertrand@my.server.com/gajim.JIXDJVOK' from='virginie@my.server.com/Conversations.XymN'>
Oct 17 11:32:12 server prosody[10907]: sql: SQL transaction begin [function(mod_storage_sql.lua:57)]
Oct 17 11:32:12 server prosody[10907]: sql: SQL transaction success [function(mod_storage_sql.lua:57)]
Oct 17 11:32:12 server prosody[10907]: my.server.com:mam: virginie's rule for bertrand@my.server.com is nil
Oct 17 11:32:12 server prosody[10907]: my.server.com:mam: virginie's default rule is true
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb3fbbd0: Archiving stanza: <message type='chat' to='bertrand@my.server.com/gajim.JIXDJVOK' from='virginie@my.server.com/Conversations.XymN'>
Oct 17 11:32:12 server prosody[10907]: sql: SQL transaction begin [function(mod_storage_sql.lua:228)]
Oct 17 11:32:12 server prosody[10907]: sql: SQL transaction success [function(mod_storage_sql.lua:228)]
Oct 17 11:32:12 server prosody[10907]: my.server.com:carbons: Sending carbon to bertrand@my.server.com/Conversations.VuSP
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb15f6c0: #queue = 1
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb15f6c0: Queuing <r> (in a moment)
Oct 17 11:32:12 server prosody[10907]: sql: SQL transaction begin [function(mod_storage_sql.lua:57)]
Oct 17 11:32:12 server prosody[10907]: sql: SQL transaction success [function(mod_storage_sql.lua:57)]
Oct 17 11:32:12 server prosody[10907]: my.server.com:mam: bertrand's rule for virginie@my.server.com is nil
Oct 17 11:32:12 server prosody[10907]: my.server.com:mam: bertrand's default rule is true
Oct 17 11:32:12 server prosody[10907]: my.server.com:mam: Archiving stanza: <message type='chat' to='bertrand@my.server.com/gajim.JIXDJVOK' from='virginie@my.server.com/Conversations.XymN'>
Oct 17 11:32:12 server prosody[10907]: sql: SQL transaction begin [function(mod_storage_sql.lua:228)]
Oct 17 11:32:12 server prosody[10907]: sql: SQL transaction success [function(mod_storage_sql.lua:228)]
Oct 17 11:32:12 server prosody[10907]: c2saaaaeaf52380: #queue = 1
Oct 17 11:32:12 server prosody[10907]: c2saaaaeaf52380: Queuing <r> (in a moment)
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb15f6c0: Sending <r> (inside timer, before send)
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb15f6c0: Sending <r> (inside timer, after send)
Oct 17 11:32:12 server prosody[10907]: c2saaaaeaf52380: Sending <r> (inside timer, before send)
Oct 17 11:32:12 server prosody[10907]: c2saaaaeaf52380: Sending <r> (inside timer, after send)
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb3fbbd0: Received[c2s]: <a xmlns='urn:xmpp:sm:3' h='18'>
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb3fbbd0: #queue = 0
Oct 17 11:32:12 server prosody[10907]: c2saaaaeaf52380: Received[c2s]: <a xmlns='urn:xmpp:sm:3' h='154'>
Oct 17 11:32:12 server prosody[10907]: c2saaaaeaf52380: #queue = 0
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb15f6c0: Received[c2s]: <a xmlns='urn:xmpp:sm:3' h='91'>
Oct 17 11:32:12 server prosody[10907]: c2saaaaeb15f6c0: #queue = 0
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: auto-starting ssl negotiation...
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: attempting to start tls on tcp{client}: 0xaaaaeb5bbd68
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: accepted new client connection from 99.99.99.99:43319 to 5281
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: auto-starting ssl negotiation...
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: attempting to start tls on tcp{client}: 0xaaaaeb5c94f8
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: accepted new client connection from 99.99.99.99:43318 to 5281
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: ssl handshake done
Oct 17 11:32:12 server prosody[10907]: http.server: Firing event: HEAD my.server.com/upload/4BULNeM7kyqwJS_N/test%20send%20gajim.png
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: ssl handshake done
Oct 17 11:32:12 server prosody[10907]: http.server: Firing event: HEAD my.server.com/upload/4BULNeM7kyqwJS_N/test%20send%20gajim.png
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: auto-starting ssl negotiation...
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: attempting to start tls on tcp{client}: 0xaaaaeb286e08
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: accepted new client connection from 99.99.99.99:43321 to 5281
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: auto-starting ssl negotiation...
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: attempting to start tls on tcp{client}: 0xaaaaeb5e1ff8
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: accepted new client connection from 99.99.99.99:43322 to 5281
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: auto-starting ssl negotiation...
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: attempting to start tls on tcp{client}: 0xaaaaeb5d9338
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: accepted new client connection from 99.99.99.99:44558 to 5281
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: ssl handshake done
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: ssl handshake done
Oct 17 11:32:12 server prosody[10907]: http.server: Firing event: HEAD my.server.com/upload/4BULNeM7kyqwJS_N/test%20send%20gajim.png
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: closed client handler and removed socket from list
Oct 17 11:32:12 server prosody[10907]: http.server: Firing event: GET my.server.com/upload/4BULNeM7kyqwJS_N/test%20send%20gajim.png
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: ssl handshake done
Oct 17 11:32:12 server prosody[10907]: http.server: Firing event: GET my.server.com/upload/4BULNeM7kyqwJS_N/test%20send%20gajim.png
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: client 99.99.99.99:43321 read error: closed
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: closed client handler and removed socket from list
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: client 99.99.99.99:43322 read error: closed
Oct 17 11:32:12 server prosody[10907]: socket: server.lua: closed client handler and removed socket from list
Oct 17 11:32:20 server prosody[10907]: c2saaaaeb15f6c0: Received[c2s]: <r xmlns='urn:xmpp:sm:3'>
Oct 17 11:32:20 server prosody[10907]: my.server.com:smacks: Received ack request, acking for 28
Oct 17 11:32:20 server prosody[10907]: c2saaaaeb3fbbd0: Received[c2s]: <r xmlns='urn:xmpp:sm:3'>
Oct 17 11:32:20 server prosody[10907]: my.server.com:smacks: Received ack request, acking for 13
Oct 17 11:32:20 server prosody[10907]: c2saaaaeb3fbbd0: Received[c2s]: <active xmlns='urn:xmpp:csi:0'>
Oct 17 11:32:20 server prosody[10907]: c2saaaaeb3fbbd0: Received[c2s]: <inactive xmlns='urn:xmpp:csi:0'>
Oct 17 11:32:20 server prosody[10907]: c2saaaaeb15f6c0: Received[c2s]: <active xmlns='urn:xmpp:csi:0'>
Oct 17 11:32:20 server prosody[10907]: c2saaaaeb15f6c0: Received[c2s]: <inactive xmlns='urn:xmpp:csi:0'>
Oct 17 11:32:20 server prosody[10907]: c2saaaaeb3fbbd0: Received[c2s]: <active xmlns='urn:xmpp:csi:0'>
Oct 17 11:32:20 server prosody[10907]: c2saaaaeb15f6c0: Received[c2s]: <active xmlns='urn:xmpp:csi:0'>
Oct 17 11:32:21 server prosody[10907]: socket: server.lua: auto-starting ssl negotiation...
Oct 17 11:32:21 server prosody[10907]: socket: server.lua: attempting to start tls on tcp{client}: 0xaaaaeb42f4d8
Oct 17 11:32:21 server prosody[10907]: socket: server.lua: accepted new client connection from 99.99.99.99:43323 to 5281
Oct 17 11:32:21 server prosody[10907]: socket: server.lua: ssl handshake done
Oct 17 11:32:22 server prosody[10907]: http.server: Firing event: HEAD my.server.com/upload/4BULNeM7kyqwJS_N/test%20send%20gajim.png
Oct 17 11:32:22 server prosody[10907]: socket: server.lua: auto-starting ssl negotiation...
Oct 17 11:32:22 server prosody[10907]: socket: server.lua: attempting to start tls on tcp{client}: 0xaaaaeb733a08
Oct 17 11:32:22 server prosody[10907]: socket: server.lua: accepted new client connection from 99.99.99.99:43324 to 5281
Oct 17 11:32:22 server prosody[10907]: socket: server.lua: ssl handshake done
Oct 17 11:32:22 server prosody[10907]: http.server: Firing event: GET my.server.com/upload/4BULNeM7kyqwJS_N/test%20send%20gajim.png
Oct 17 11:32:22 server prosody[10907]: socket: server.lua: client 99.99.99.99:43324 read error: closed
Oct 17 11:32:22 server prosody[10907]: socket: server.lua: closed client handler and removed socket from list
Oct 17 11:32:32 server prosody[10907]: c2saaaaeb04eb50: Received[c2s]: <r xmlns='urn:xmpp:sm:3'>
Oct 17 11:32:32 server prosody[10907]: my.server.com:smacks: Received ack request, acking for 46
Oct 17 11:32:34 server prosody[10907]: socket: server.lua: client 99.99.99.99:43316 read error: closed
Oct 17 11:32:34 server prosody[10907]: socket: server.lua: closed client handler and removed socket from list