Issue with ldapjs and string base64 format

674 views Asked by At

I have a LDAP server and the users have a property which is a jpeg photo in base64 format.

When I search for the user, this specific attribute comes with a weird string format: ,��1�3�>��F��ԯ�]KW�t�.<I����zu�+\�s�9[Hd������(��4

It seems that there's an encoding issue or something.

Do you know what can I do in order to convert to base64?

I am using nodejs and ldapjs client for connecting to the LDAP server.

Thanks

1

There are 1 answers

0
LisaJ On BEST ANSWER

I had a similar issue, and an Issue on the ldapjs github page provided the solution. Essentially you're getting the value converted to a string (which, as you see is a bunch of useless rubbish) and need to get the unconverted buffer for binary properties. The second post in the issue provides code to accomplish this.