[Mayan EDMS: 1821] Uploading pdf files with mayan-api_client not working

classic Classic list List threaded Threaded
2 messages Options
Ben
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Mayan EDMS: 1821] Uploading pdf files with mayan-api_client not working

Ben
I want to use the mayan-api_client to upload documents( to automate file uploads from a windows machine )
On a Linux machine it works as expected but on a Windows machine ( Win 7, Mayan on Ubuntu 16.04) it doesn't upload PDFs.
I'm using this command:

api = API(host='http://192.168.1.6', username='admin', password='something')
with open('c:\Users\User\Documents\test.pdf') as file_object:
    response = api.documents.documents.post({'document_type': 2}, files={'file': file_object})

All other file types are working, except PDF. The file is corrupted on the server - only a few bytes are there, therefor it cannot be proceeded and it gives me this error:

converter.backends.python <12314> [ERROR] "get_page_count() Exception determining PDF page count; Unexpected EOF".

I have no problems to upload the same file using the web interface.

It seems there is a problem with the file transfer to the server. But why only PDFs?

Any ideas where the problem could be?



--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Mayan EDMS: 1826] Re: Uploading pdf files with mayan-api_client not working

rosarior
Administrator
Never seen this issue before and don't have a Windows machine or VM readily available for testing. 

Could be a content type or HTTP encoding issue. Try uploading the PDF zipped. If the PDF file is corrupted, it is being introspecting/changed in transit and not just mangled by the HTTP/IP stack.

Make sure the PDFs are not infected with a malware and something is "cleaning" them up.

Turn off any antivirus or antimalware in Windows. Also make sure nothing is filtering or throttling the IP port of the API.

Test with PDFs created with other software and with others from a know good source.

Upload them from another computer in case the computer you are using for the client is infected and infecting the PDF on transit or when being opened.

Try uploading the PDF files via the API client from a Linux distro to see if the problem is at the sending or receiving end.

On Tuesday, June 27, 2017 at 4:21:54 PM UTC-4, Ben wrote:
I want to use the mayan-api_client to upload documents( to automate file uploads from a windows machine )
On a Linux machine it works as expected but on a Windows machine ( Win 7, Mayan on Ubuntu 16.04) it doesn't upload PDFs.
I'm using this command:

api = API(host='<a href="http://192.168.1.6" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.1.6\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEh_NjtP1GKjuzlq_FDd1dCczGL_Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F192.168.1.6\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEh_NjtP1GKjuzlq_FDd1dCczGL_Q&#39;;return true;">http://192.168.1.6', username='admin', password='something')
with open('c:\Users\User\Documents\test.pdf') as file_object:
    response = api.documents.documents.post({'document_type': 2}, files={'file': file_object})

All other file types are working, except PDF. The file is corrupted on the server - only a few bytes are there, therefor it cannot be proceeded and it gives me this error:

converter.backends.python <12314> [ERROR] "get_page_count() Exception determining PDF page count; Unexpected EOF".

I have no problems to upload the same file using the web interface.

It seems there is a problem with the file transfer to the server. But why only PDFs?

Any ideas where the problem could be?



--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...